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

How can I run a C++ program directly from Windows?

How-can-I-run-a-C-program-directly-from-Windows