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

Derivatives stock list at NSE

Complete FNO stock list at NSE. ABB India Ltd ACC Ltd APL Apollo Tubes Ltd AU Small Finance Bank Ltd Aarti Industries Ltd Abbott India Ltd A...