Reputation: 827
There is a parent bean with some properties,out of those properties one is an ArrayList
. Now this ArrayList
is initialized with the properties of a child bean. Now how can i get access to these properties in jsp using spring form tags? Actually i need to iterate through the ArrayList
and access its properties. My code is given below,
<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)"/>
</c:if>
The error is being thrown because of this path="documentlist.ynChkBox"
, please help!!
Upvotes: 1
Views: 1596
Reputation: 3795
Looking at your code in jsp, you need to make sure that your form and its properties are as below:
public class Policydocumentsetform implements Serializable{
...
//I would rather go with List
private ArrayList<Document> documentList;
...
}
where document is the bean containing:
public class Document implements Serializable{
...
private String txtDisableCheckBox;
private String ynChkBox;
...
}
Try this way:
<c:forEach var="document" items="${policydocumentsetform.documentList}" varStatus="documentStatus">
<c:if test="${document.txtDisableCheckBox=='N'}">
<form:checkbox path="document[${documentStatus.index}].ynChkBox" cssClass="genradio" value="-1" onclick="selectCheckBox(event.keyCode,this)"/>
</c:if>
</c:forEach>
Upvotes: 1