dimanche 12 novembre 2017

unable to grab values in checkbox struts 2

In my Action.java.

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