• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to get both value and text of selected item in action class

 
Author
Posts: 47
5
MySQL Database PHP Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using struts 1.1 and the problem relates to dropdown selected item text.
My jsp has a select list as follows:

<html:select styleId="state" property="state" onchange="loadList('state', 'districtCell', 'district')">
<c:forEach var="thisState" items="${stateMap}">
<html:option value="${thisState.key}">${thisState.value}</html:option>
</c:forEach>
</html:select>


where stateMap is a hash map
There are other such lists with
<option value="${city_id}">${cityName}</option>

When the form is submitted, I want the action class to be able to access the value of the selected item in the list(which it is doing) and
the text of the selected item also(which I do not know how to do.)

The form bean has getter setter methods for each list, but only the value seems to be submitted.



 
Would you turn that thing down? I'm controlling a mind here! Look ... look at the tiny ad ...
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic