• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to pass value from Java script to JSP

 
Ruth Ambika
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,




 
Pushkar Choudhary
Rancher
Posts: 425
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ruth,
Welcome to Javaranch!

Found this older thread discussing the same. See if it helps!
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!