aspose file tools*
The moose likes Struts and the fly likes Passing selected values from javascript in JSP  to Action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Passing selected values from javascript in JSP  to Action" Watch "Passing selected values from javascript in JSP  to Action" New topic
Author

Passing selected values from javascript in JSP to Action

reethu shivanna
Greenhorn

Joined: Sep 09, 2012
Posts: 3
Please help! ASAP

JSP code :

<select name="env">
<option><%loaded on runtime%></option>
</select>

Javascript:
<script >
var a = document.form["InputForm"];
var selectedIndex = a.selectedIndex.value;
var selectedValue = a.options[selectedIndex].text;
alert(selectedValue );
</script>
<!-- working till here -->

I want to pass this selected value to my Action class

Please help me
jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

hi Reethu,

You can pass this variable as hiddden parameters from jsp . Or if you have define this variable in struts form you can set the value of form variable in javascript.
Struts has nutting to do with this.

Regards
jatan
 
 
subject: Passing selected values from javascript in JSP to Action