In my Action.java:
//I will iterate this map in jsp
Map<Fruit,String> fruitMap;
// I will add the checkbox selected by users into this set
EnumSet<Fruit> fruits
In my action.jsp, I want to print fruitMap. Each option in checkbox should display map's key + value (for example, one checkbox displays : apple (key) 200 dollars 35 items (value)). Then based on what users select, I want to add map key (fruit) into fruits. For example, if a user select "apple 200 dollars 35 items ", I will add apple into fruits. This is what I got so far:
<s:iterator value="fruitMap">
<s:checkbox name="sd" value="%{value}"/>
<s:property value="%{key}"/> <s:property value="%{value}"/>
</s:iterator>
May someone tell me how to actually add checkbox selected by users into fruits(Enumset).
Aucun commentaire:
Enregistrer un commentaire