Monday, April 13, 2020

Accessing JavaScript variable in JSP and vice-versa


Pass value from javascript to Jsp scriplet:

h.jsp:

<script>
function get(){
var m="Hello";
window.location.replace("h.jsp?mess="+m);
}
</script>
<input type="button" onclick="get();" value="click">
<%String message=request.getParameter("mess");
out.println(message);
%

source:https://www.javatpoint.com/q/5474/can-we-access-javascript-variable-in-jsp-and-vice-versa

No comments:

Post a Comment

Sacred Thought

5 May 2024 Hari Om Verse 50-51, chapter two:  In this chapter two Shree krishna explains a simple way of living. Free from desires and void ...