在我的 Struts 表单中,我有一个列表。在 JSP 中,我像这样迭代它:
<c:forEach items="${MyForm.types}" var="type">
<tr>
<td>${type.name}</td>
<td>${type.forced}</td>
<td>${type.receive}</td>
<html:checkbox property="type.receive" />
</tr>
</c:forEach>
现在是<html:checkbox
不工作。我总是收到以下错误:
Caused by: javax.servlet.jsp.JspException: No getter method for property type.receive of bean org.apache.struts.taglib.html.BEAN
但实际上我的表单类中有一个该属性的 setter/getter 。是这样写的:
public Boolean getReceive() {
return receive;
}
当我删除该复选框时,也可以显示该属性,如 <td>
中所示。 - 上面的标签,所以我不知道问题出在哪里。
也许我以错误的方式访问它?
最佳答案
struts Action 表单中的所有单个属性类型都应该是 String。您必须将 cbx_uebernehmen 定义为 String 类型。
关于java - 无法使用 <html :checkbox property ="..."> when iterating a list 访问属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3061169/