
JSP that accepts a string parameter from the browser and simply displays it back in the HTML response.

Hi Friend,
Try the following code
1)passtohtml.jsp:
<html> <form name="form" method="get" action="display.html"> Enter Message: <input type="text" name="msg"> <input type="submit" value="submit"> </form> </html>
2)display.html:
<script type="text/javascript">
function getParameter(name){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec(window.location.href);
if( results == null )
return "";
else
return results[1];
}
var value = getParameter("msg");
document.writeln("You have entered: "+value);
</script>
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.