Search This Blog

Friday, December 16, 2011

Passing value from javascript to jsp page

write the javascript function to pass javascript value as a queryString

For Ex sample.jsp :
-------------------

step1:

function passValue(){
var jsValue="India";
window.location.replace("sample.jsp?message="+jsValue);
}

step2:

Add the html button to call the passValue() method during onclick

input type="button" onclick="passValue();" value="click"

<%String message=request.getParameter("message");
out.println(message);
%>

No comments:

Post a Comment