GeeCON Prague 2014*
The moose likes Spring and the fly likes Spring can't find bean property in a list element. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring can Watch "Spring can New topic
Author

Spring can't find bean property in a list element.

sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
Hi with spring MVC 3.0.5 and jsp, I tried to treverse a List of beans, but it thrown the following exception:

...
02:15:53,992 ERROR [org.springframework.web.servlet.tags.form.LabelTag] (http--192.168.1.20-8080-3) Invalid property 'article' of bean class [LuxuryLiving.manager.pagebean.ProductBean]: Bean property 'article' 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.NotReadablePropertyException: Invalid property 'article' of bean class [LuxuryLiving.manager.pagebean.ProductBean]: Bean property 'article' 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.getPropertyValue(BeanWrapperImpl.java:707) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:555) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:532) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
....



jsp code:



productbean class:



ProductArticleBean class:



I know the problem is in my jsp file, but I couldn't figured out how to correct the error.
Any suggestion is very appreciated.
Thanks
Sam
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Looks like you have a typo somewhere. Not what I see, but somewhere, and might not be that loop in the jsp

"Invalid property 'article' of bean class [LuxuryLiving.manager.pagebean.ProductBean]: Bean property 'article'"

That says to me, somewhere you forgot an "s" in the name of the property, as ProductBean has "articles" but not "article" Do a text find in your jsp.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
I changed to something like this:



Is this correct? Now error is free, but I am not sure whether this will pick up the value from my backing bean (productbean).
thanks
Sam
sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
I have added more codes to it, but error comes back.
Here is the code:



The error message is:

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.NotReadablePropertyException: 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.getPropertyValue(BeanWrapperImpl.java:707) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:555) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:532) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:697) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:98) [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:224) [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.supp
 
GeeCON Prague 2014
 
subject: Spring can't find bean property in a list element.