lundi 13 novembre 2017

take values in checkbox generated by a map

In my action class Action.java, I have following:

Map<Fruit,String> fruitMap;

// I will add the checkbox values into this set 
EnumSet<Fruit> fruits;
public EnumSet<Subject> getSubjects() {
    return subjects;
}

public void setSubjects(EnumSet<Subject> subjects) {
  this.subjects = subjects;
}

I am able to iterate map in jsp but I am unable to take values in checkbox.

<s:form action="selectFruit" id="1234" >
    <s:iterator value="fruitMap">
      <s:checkbox name="fruits" />
      <s:property value="%{key.toDisplayText()}"/>  <s:property value="%{value}"/> <br><br>
    </s:iterator>
    <s:submit value="Continue" type="submit"/>
</s:form>

How do I tell my jsp to store checkbox values in fruits (enumset)?




Aucun commentaire:

Enregistrer un commentaire