我被我的代码困住了,我需要帮助。我希望能够访问jsp页面中arraylist的属性。下面给出的是代码片段和错误。任何帮助将不胜感激!
public class Policydocumentsetform implements Serializable{
...
private ArrayList<Document> documentList;
...
}
public class Document implements Serializable{
...
private String txtDisableCheckBox;
private String ynChkBox;
...
}
<c:forEach var="documentlist" items="${policydocumentsetform.documentList}">
<c:if test="${documentlist.txtDisableCheckBox=='N'}">
<form:checkbox path="documentlist.ynChkBox" cssClass="genradio" value="-1" onclick="selectCheckBox(event.keyCode,this)"/>
org.springframework.beans.NotReadablePropertyException: Invalid property 'documentlist' of bean class [gc.dms.bean.PolicyDocumentSetForm]
答案 0 :(得分:5)
例外:
org.springframework.beans.NotReadablePropertyException: Invalid property 'documentlist' of bean class [gc.dms.bean.PolicyDocumentSetForm]
可能在
<form:checkbox path="documentlist.ynChkBox" //Here, is the problem
cssClass="genradio"
value="-1"
onclick="selectCheckBox(event.keyCode,this)"/>
解,
我在考虑您已将Policydocumentsetform
个问题添加为commandName
或modelAttribute
,并尝试使用弹簧复选框(<form:checkbox..
),如果是这样的话:
<form:form commandName="policydocumentsetform"...>
<c:forEach var="document" items="${policydocumentsetform.documentList}" varStatus="documentLoop">
<c:if test="${document.txtDisableCheckBox=='N'}">
<form:checkbox path="documentList[${documentLoop.index}].ynChkBox"
cssClass="genradio"
value="-1"
onclick="selectCheckBox(event.keyCode,this)"/>
</c:if>
</c:forEach>
<子>注意:
确保Policydocumentsetform
和Document