I have one Class PaymentForm, inside it I have one variable of type Issuer. Inside Issuer there is one var addressList of type Address, which have three vars addrId, addressLine1 and payment. The payment is of type Payment and at last there is one var in Payment, paymentAmt of type int.
So I have to iterate the List (addressList) in jsp. There is two input boxes and one label in jsp which is mapped to addrId and addressLine of Address and payment of Payment. which is somewhere deep down in the List.
What I have tried so far
1) "payForm" is the commandName declared at the form level, counter is the var declared at the top of the page in scripplet.
<c:forEach var="pointer" varStatus="loopStatus" items="payForm.issuer.addressList">
<DIV style="width: 100%; height: 100%; overflow: auto;">
<tr>
<td>
<b><%=counter++%>)</b>
</td>
<td><form:input style="display:none;" path="issuer.addressList[${loopStatus.index}].addrID"/> </td>
<td><c:out value="${pointer.addressLine}"/></td>
<td><form:input path="issuer.addressList[${loopStatus.index}].payment.paymentAmt" size="17" maxlength="12"/></td>
</tr>
</DIV>
</c:forEach>
Error With this :-
org.apache.jasper.JasperException: javax.el.PropertyNotFoundException: The class 'java.lang.String' does not have the property 'addressLine'.
2)
<td><c:out value="${issuer.addressList[${loopStatus.index}].addressLine}"/> </td>
Error With this is:-
org.apache.jasper.JasperException: /WEB-INF/pages/invoice.jsp(162,17) "${issuer.addressList[${loopStatus.index}].addressLine}" contains invalid expression(s): {1}
3)
<td><c:out value="${payForm.issuer.addressList[${loopStatus.index}].addressLine}"/></td>
Error With this:-
org.apache.jasper.JasperException: /WEB-INF/pages/invoice.jsp(162,17) "${payForm.issuer.addressList[${loopStatus.index}].addressLine}" contains invalid expression(s): {1}
No issue with first and third field. Only the middle one is creating problem here.
It started working With below code
<td><c:out value="${payForm.issuer.addressList[0].addrID}"/></td>
But its harcode. How to get the value 0,1,2,3... using "loopStatus" var of c:if
Aucun commentaire:
Enregistrer un commentaire