struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane Cosmeur <cosm...@gmail.com>
Subject Populate s:select with a Map
Date Tue, 13 Apr 2010 04:51:22 GMT
Hello

I know my problem is quite common but i can't figure out by google and
myself, although many people had the same problem.

I try to populate a s:select with a map (Map<Integer, String>, but i got the
(well known) following error :
tag 'select', field 'list', id 'typeCompanyENUM', name 'typeCompanyENUM':
The requested list key 'mapTypeCompanyENUM' could not be resolved as a
collection/array/map/enumeration/iterator type. Example: people or
people.{name} - [unknown location]

I have getters and setters on my Map and the map is populated :

public Map<Integer, String> getMapTypeCompanyENUM() {
 return mapTypeCompanyENUM;
}

public void setMapTypeCompanyENUM(Map<Integer, String> mapTypeCompanyENUM) {
 this.mapTypeCompanyENUM = mapTypeCompanyENUM;
}

My declare my s:select as follows :
<s:select id="typeCompanyENUM" name="typeCompanyENUM" label="Select company
type" list="mapTypeCompanyENUM" listKey="typeCompanyENUM.{key}"
 listValue="typeCompanyENUM.{value}"
 headerValue="-- Please Select --"/>

I know the problem is about the listKey and listValue attribute. I tried
many thing, but no ones worked out :
listKey="typeCompanyENUM.{key}"
listValue="typeCompanyENUM.{value}"
...

I dont know either if i should use the attribute of s:select, key and value.
I saw many diffrent case on diffrent mailing list and i am a bit lost among
all of those.

Thank you for your help.

-- 
St├ęphane Cosmeur
06 33 54 36 04

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message