-
Recent Posts
-
February 2012 M T W T F S S « Apr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Archives
Tag Archives: How to call Jsp page from Javascript
How to call Jsp page from Javascript?
We can call JSP page from JavaScript using the property window.location.href. Example: Hello.html: <html> <head> <title>Add Faulty Phones</title> <script type=”text/javascript”> function changeLocation() { window.location.href =’hello.jsp?name=John’; } </script> </head> <body> <form method=get> <INPUT TYPE=BUTTON ONCLICK=”changeLocation()” VALUE=”Click”> </form> </html> Note: “window.location.href = ‘download.jsp’?name=john;” where download.jsp is jsp file, name is parameter name and john is parameter value. hello.jsp: <center>Hello <%=requset.getParameter(“name”)%> </center>