Forums Register Login

How to pass value from Java script to JSP

+Pie Number of slices to send: Send
Hi All,

In my JSP i have a drop down, it calls a java script function and captured the value. I want to pass the selected value(var label) (before submit the form) to my JSP to proceed further. Can any one help me in this regard.

Here is my code,




+Pie Number of slices to send: Send
Ruth,
Welcome to Javaranch!

Found this older thread discussing the same. See if it helps!
+Pie Number of slices to send: Send
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.

And welcome to JavaRanch!
+Pie Number of slices to send: Send
Impossible. The JSP executes on the server long before the page gets sent to the browser for display. Once the page leaves the server, the JSP is done.

For an explanation of how JSP works and why this is impossible, please read this article.

You can send the value back to the server, either as a form submission, a redirect, or an Ajax request, but it will generate a new request -- not execute in the original JSP.
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1183 times.
Similar Threads
Drop down population Issue.
Dropdown Selected returning unexpected value on submit.
Jquery form validation
Sorting array in bind("change", function()
Display result is reverted back (JSP and JQuery)
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 12:52:43.