Mapper l'attribut name d'une checkbox avec une map
Bonsoir,
j'ai le code struts2 suivant :
Code:
1 2 3 4 5 6
| <s:iterator value="cb">
<tr>
<th scope="row"><s:checkbox name="choix[%{key}]" fieldValue="true" theme="simple" value="%{value}"/></th>
<td><s:property value="key"/></td>
</tr>
</s:iterator> |
"cb" est une hashmap associant un String à un booleen.
Cet itérateur s'inscrit dans le contexte d'un formulaire appelant une action dont la classe action est :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| public class maClasse extends ActionSupport{
private Map<String, Boolean> choix = new HashMap<String, Boolean>();
public Map<String, Boolean> getChoix() {
return choix;
}
public void setChoix(Map<String, Boolean> choix) {
this.choix = choix;
}
@Override
public String execute() throws Exception {
return SUCCESS;
}
} |
Le problème est que dans la méthode execute "choix" est vide..
On dirait que le mapping n'est pas fait mais je ne comprends pas pourquoi.