Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing selected values from javascript in JSP to Action

 
reethu shivanna
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic