| Author |
how can i pass a javascript variable to a jsp page
|
naro pad
Ranch Hand
Joined: May 07, 2008
Posts: 58
|
|
I have one jsp page which has on it some javascript.Within the javascript I have one variable and I want that variable after submitting the form to passed as a parameter to the submitted jsp How can I do that? Thanks
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56223
|
|
Copy the value of the variable into a hidden input within the form. [ May 20, 2008: Message edited by: Bear Bibeault ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
naro pad
Ranch Hand
Joined: May 07, 2008
Posts: 58
|
|
Because I'm a beginner can you explain me a little more... I have this <script> var times; function(){ times++; } </script> ... <form> ... <input type="submit" value="Save"/> <input type="hidden" value=" ? "/>
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56223
|
|
|
In the onsubmit handler for your form, assign the value of the variable to the value property of the input element.
|
 |
 |
|
|
subject: how can i pass a javascript variable to a jsp page
|
|
|