I'm trying to use doubleselect
tag from Struts2 by using this link as a guide. When I select the telephone country code (ex: 91, 92, 216), it should display three cities from that country.
For this I have a Map<Integer, List<String>
. Below is the tag.
<s:doubleselect
name="obj.countryCode" id="countryCode" list="countryCodeCityNameMap.keySet()"
doubleName="obj.cityName" doubleId="cityName" doubleList="countryCodeCityNameMap" />
This yields a different output. In the first drop-down it displays the country code properly. But irrespective of the selected value in the first drop-down it always shows all the values in the second drop-down like this:
[aaa,bbb,ccc]
[ddd,eee,fff]
[ggg,hhh,iii]
How can i use the Map to get the desired output? Should I create a structure like this as per the given link:
List<Makes> // in first drop-down
Makes contains makeId, modelId and List<Models> // List<Models> in second drop-down
Models contains modelId and modelName
If yes, then how does my scenario fit in to this model?