我在行动和jsp之间传递了一些麻烦,我不明白为什么。这是我的代码:
<s:iterator value="listaCategorie">
<tr>
<td><s:property value="idCategoria" /></td>
<td><s:property value="name" /></td>
<s:form action="addPref">
<td><s:submit type="button" name="btnName" value="idCategoria" /></td>
</s:form>
<s:form action="removePref">
<td><s:submit type="button" name="btnName" value="idCategoria" /></td>
</s:form>
</tr>
</s:iterator>
我无法传递变量idCategoria中的值。这是我的行动代码:
public String aggiungiPreferenza() throws Exception {
//esegui l'azione in base ad add/rem pref
Map<String, Object> session = ActionContext.getContext().getSession();
userBean = (User) session.get("user");
if(userService.aggiungiPreferenza(idCategoria, userBean))
return SUCCESS;
else return INPUT;
}
public String rimuoviPreferenza() throws Exception {
//esegui l'azione in base ad add/rem pref
Map<String, Object> session = ActionContext.getContext().getSession();
userBean = (User) session.get("user");
if(userService.rimuoviPreferenza(idCategoria, userBean))
return SUCCESS;
else return INPUT;
}
你能帮帮我们吗?谢谢。