• Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing selected values from javascript in JSP to Action  RSS feed

 
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!