| | |
pass session variable with window.location.href jsp
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hello,
I would like to use a button as a link and pass the session variable in a jsp!
The below code should work.
Any help is appreciated.
Thanks.
I use encodeURL if the user has cookies off.
This works with links but not when using an input button with window.location.href.
I would like to use a button as a link and pass the session variable in a jsp!
The below code should work.
Any help is appreciated.
Thanks.
I use encodeURL if the user has cookies off.
This works with links but not when using an input button with window.location.href.
java Syntax (Toggle Plain Text)
<input type="button" value="Copy" onClick="window.location.href='<%= response.encodeURL("http://www.mysite/index.jsp?switch="+ intvariable) %>'">
Your quoting seems to be off. Try something like:
JSP Syntax (Toggle Plain Text)
<script type="text/javascript"> function redirectUser() { var url = '<%= response.encodeURL("http://www.mysite/index.jsp?switch="+ intvariable) %>'; window.location.href = url; } </script> <!-- more code --> <input type="button" value="Copy" onclick="redirectUser();">
I don't accept change; I don't deserve to live.
![]() |
Other Threads in the JSP Forum
- Previous Thread: Webservice as Xml format
- Next Thread: need help
| Thread Tools | Search this Thread |
apache backbutton combobox connection database development directorystructure dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 network parameters passing ping printinserverinsteadofclient redirect request.getparameter response servlet servletdopost()readxml sessions software ssl state_saving_method stocks sun tomcat tutorial update video web






