sherihan
Feb 2nd, 2005, 03:30 AM
Hi,
I have a form that is used to edit invoice details.
It contains a button. Whenever the user clicks this button a new row is added (using javascript) so that the user can add a new item line to the invoice.
The invoice class is as follows:
public class Invoice extends BaseObject implements Serializable {
private Long id;
private Integer invoiceNumber;
private Customer customer;
private Date date;
private Set itemLines = new HashSet();
private double totalPrice;
The itemLine class is as follows:
public class ItemLine extends BaseObject implements Serializable {
private Long id;
private Item item;
private double quantity;
private double unitPrice;
private double totalPrice;
private Invoice invoice;
The item class is as follows:
public class Item extends BaseObject implements Serializable {
private Long id;
private String name;
private String code;
private double unitPrice;
private ItemType itemType;
private Set itemLines = new HashSet();
The JSP code is:
<spring:bind path="invoice.itemLines">
<c:forEach varStatus="loop" items="${invoice.itemLines}" var="anItemLine">
<tr>
<spring:bind path="invoice.itemLines[${loop.index}]">
<input type="hidden" name="${status.expression}" value="${anItemLine.id}"/>
<spring:bind path="invoice.itemLines[${loop.index}].item">
<td><input type="text" name="${status.expression}" value="${anItemLine.item.code}"/></td>
</spring:bind>
<spring:bind path="invoice.itemLines[${loop.index}].quantity">
<td><input type="text" name="${status.expression}" value="${status.value}"/></td>
</spring:bind>
</spring:bind>
<td><input type="button" name="deletebutton" value="Delete" onclick="javascript: deleteOldRow(this);"/></td>
</tr><% x++ ;%>
</c:forEach>
</spring:bind>
I created two propperty editors one for the itemLines and the other for the item.
I have no problem in showing an invoice.
All the invoice data and its item Lines are displayed correctly.
But the problem is that when I add a new item Line and try to submit the form, I get the following error:
org.springframework.beans.InvalidPropertyException :Invalid property 'itemLines[0]' of bean class [com._4s_.invoice.model.Invoice]: Property referenced in indexed property path 'itemLines[0]' is neither an array nor a List nor a Map; returned value was [3]
Why does this happen?
Could anyone help me?
Thanks in Advance.
I have a form that is used to edit invoice details.
It contains a button. Whenever the user clicks this button a new row is added (using javascript) so that the user can add a new item line to the invoice.
The invoice class is as follows:
public class Invoice extends BaseObject implements Serializable {
private Long id;
private Integer invoiceNumber;
private Customer customer;
private Date date;
private Set itemLines = new HashSet();
private double totalPrice;
The itemLine class is as follows:
public class ItemLine extends BaseObject implements Serializable {
private Long id;
private Item item;
private double quantity;
private double unitPrice;
private double totalPrice;
private Invoice invoice;
The item class is as follows:
public class Item extends BaseObject implements Serializable {
private Long id;
private String name;
private String code;
private double unitPrice;
private ItemType itemType;
private Set itemLines = new HashSet();
The JSP code is:
<spring:bind path="invoice.itemLines">
<c:forEach varStatus="loop" items="${invoice.itemLines}" var="anItemLine">
<tr>
<spring:bind path="invoice.itemLines[${loop.index}]">
<input type="hidden" name="${status.expression}" value="${anItemLine.id}"/>
<spring:bind path="invoice.itemLines[${loop.index}].item">
<td><input type="text" name="${status.expression}" value="${anItemLine.item.code}"/></td>
</spring:bind>
<spring:bind path="invoice.itemLines[${loop.index}].quantity">
<td><input type="text" name="${status.expression}" value="${status.value}"/></td>
</spring:bind>
</spring:bind>
<td><input type="button" name="deletebutton" value="Delete" onclick="javascript: deleteOldRow(this);"/></td>
</tr><% x++ ;%>
</c:forEach>
</spring:bind>
I created two propperty editors one for the itemLines and the other for the item.
I have no problem in showing an invoice.
All the invoice data and its item Lines are displayed correctly.
But the problem is that when I add a new item Line and try to submit the form, I get the following error:
org.springframework.beans.InvalidPropertyException :Invalid property 'itemLines[0]' of bean class [com._4s_.invoice.model.Invoice]: Property referenced in indexed property path 'itemLines[0]' is neither an array nor a List nor a Map; returned value was [3]
Why does this happen?
Could anyone help me?
Thanks in Advance.