With spring 3.0.5 and jsp, I written 3 beans, jsp page is used to display the values from the bean fields.
Here is the jsp file:
ProductBean.java class:HTML Code:<c:forEach var="article" items="${productbean.articles}" varStatus="loopStatus" > <tr> <td>Article Header</td> <td> <spring:bind path = "productbean.articles[${loopStatus.index}].header"> <Error messages></Error> <form:input name = "header" id = "header" path="${productbean.articles[loopStatus.index].header}" size="100" value="${productbean.articles[loopStatus.index].header}"/> </spring:bind> </td> </tr> <tr> <td>Article Description</td> <td> <spring:bind path = "productbean.articles[${loopStatus.index}].productDesc"> <Error messages></Error> <form:textarea name = "productDesc" id = "productDesc" path="${productbean.articles[loopStatus.index].productDesc}" value="${productbean.articles[loopStatus.index].productDesc} " rows="8" cols="65"/> </spring:bind> </td> </tr> <c:forEach var="pf" items="$article.pointForms" varStatus="loopStatus" > <tr> <td>Article Point-form</td> <td> <spring:bind path = "pf.pointFormDesc"> <Error messages></Error> <form:input name = "pointForm" id = "pointForm" path="${pf.pointFormDesc}" value="${pf.pointFormDesc}" size="100" /> </spring:bind> </td> </tr> </c:forEach> </c:forEach>
ProductArticleBean.java class:Code:public class ProductBean { private static final Logger logger = Logger.getLogger(ProductBean.class); private String productId = ""; @Size(min=6, max=80, message="Product name must be between 6 and 80 characters") private String productName = ""; private List<ProductArticleBean> articles;
PointForm.java class:Code:public class ProductArticleBean { protected String articleId; protected String productId; @Size(min = 2, max = 60, message="Header field must be >= 2 and <= 60 .") protected String header = ""; protected List<PointForm> pointForms; @Size(min = 2, max = 2000, message="Product description field must be >= 2 and <= 2000 .") protected String productDesc = "";
Error message is:Code:public class PointForm { private Integer articleId = -1; private Integer pointFormId = -1; @Size(min = 2, max = 50, message="Point-form field must be >= 2 and <= 50 .") private String pointFormDesc = "";
I've been trying to resolve this error for few days, but I can't go any further.10:22:26,607 ERROR [org.springframework.web.servlet.tags.BindTag] (http--192.168.1.20-8080-8) Invalid property 'pf' of bean class [LuxuryLiving.manager.pagebean.ProductBean]: Bean property 'pf' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?: org.springframework.beans.NotReadablePropertyExcep tion: Invalid property 'pf' of bean class [LuxuryLiving.manager.pagebean.ProductBean]: Bean property 'pf' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(BeanWrapperImpl.java:707) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.BeanWrapperImpl.getNeste dBeanWrapper(BeanWrapperImpl.java:555) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.BeanWrapperImpl.getBeanW rapperForPropertyPath(BeanWrapperImpl.java:532) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(BeanWrapperImpl.java:697) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.validation.AbstractPropertyBin dingResult.getActualFieldValue(AbstractPropertyBin dingResult.java:98) [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.validation.AbstractBindingResu lt.getFieldValue(AbstractBindingResult.java:224) [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.supp
Any suggestion is very appreciated.
Thanks
Sam


Reply With Quote