You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eduardo Solanas <ed...@gmail.com> on 2008/06/07 02:21:29 UTC

[Struts2] Help please!!! how to map select tag with listkey and listvalue into a java object with his ids and names?

Hi, i have tried it, looking for the solution in books and google and i
can't do this.

i have a select tag in my jsp <s:select list="countries"
listkey="nameCountry" listValue="idCountry" multiple="true" size="11"/>

in my action i have

List countries=new ArrayList();

with getCountries()/setCountries(List countries);

I have a country.java with
String idCountry="";
String nameCountry="";
with get/setters

Can i map all the names and keys of the selected items in the list of my
action? I only get a list with the ids of the countries selected, but i cant
map the name of the countries selected... :(

I have tried List<Country> countries=new ArrayList<Country>();
and doesn't work, do i need a converter? i have tried an annotacion
converter and i doesn't work too maybe cos i don't undestand it so much, so
please can you help me??

thanks