0

I need to pass the value and text of select box to java action class in Struts2. I have a map object that supply key value to the select box.

<s:select multiple="true" size="10" name="reportColumns" list="reportHeader"  />

suppose my option is:

<option value="project.name">projectname</option>

I need to pass both project.name(value) and projectname(text) to java class.

i came to know its possible to sent value as project.name.projectname, but i don't want to like as above.

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
Justin
  • 13
  • 5

1 Answers1

0

So you have a Map called "reportHeader" from which you present values through a dropdown. In your example above "project.name" should be your key and "projectname" your value in the Map.

If you submit your form then then variable "reportColumns" should have your selection, meaning it will hold the value you chose. If you also want the corresponding key then customize a method to fetch it.

Example here: enter link description here

Community
  • 1
  • 1
jedidog
  • 260
  • 1
  • 7