I want to present a choice of provinces with the Spring 2.5.6 form:options.
I have defined getProvince and setProvince functions.
Please help to solve the following run time error.
Thanks.
Runtime error with eclipse:
16:44:52,312 ERROR org.springframework.web.servlet.tags.form.OptionsTag:84 - Invalid property 'province' of bean class [java.lang.String]: Bean property 'province' 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 'province' of bean class [java.lang.String]: Bean property 'province' 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:540)
at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:532)
at org.springframework.web.servlet.tags.form.OptionWriter.doRenderFromCollection(OptionWriter.java:190)
at org.springframework.web.servlet.tags.form.OptionWriter.renderFromArray(OptionWriter.java:148)
at org.springframework.web.servlet.tags.form.OptionWriter.writeOptions(OptionWriter.java:129)
at org.springframework.web.servlet.tags.form.OptionsTag.writeTagContent(OptionsTag.java:157)
at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:90)
at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:77)
at org.apache.jsp.WEB_002dINF.jsp.addUser_jsp._jspx_meth_form_005foptions_005f0(addUser_jsp.java:780)
at org.apache.jsp.WEB_002dINF.jsp.addUser_jsp._jspx_meth_form_005fselect_005f0(addUser_jsp.java:741)
at org.apache.jsp.WEB_002dINF.jsp.addUser_jsp._jspService(addUser_jsp.java:292)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
I would remove itemLabel and itemValue attributes as it is trying to call the get method on the Strings that are in the array, and not your Command object. It is already tied to your command object with your <form:select> tag.
Mark Spritzler wrote:I would remove itemLabel and itemValue attributes as it is trying to call the get method on the Strings that are in the array, and not your Command object. It is already tied to your command object with your <form:select> tag.
Mark
Your solution works.
Thanks!!!
A related question:
The provinces display the entire choice on the screen.
How to display only one choice on the screen and the user move the mouse or the cursor key to get more choice?
You mean like a drop down? Or something else. I thought what you had was a drop down already.
Which widget do you want?
Thanks
Mark
albert kao
Ranch Hand
Joined: Feb 04, 2010
Posts: 224
posted
0
albert kao wrote:
Mark Spritzler wrote:I would remove itemLabel and itemValue attributes as it is trying to call the get method on the Strings that are in the array, and not your Command object. It is already tied to your command object with your <form:select> tag.
Mark
Your solution works.
Thanks!!!
A related question:
The provinces display the entire choice on the screen.
How to display only one choice on the screen and the user move the mouse or the cursor key to get more choice?
Setting the size to 1 achieve my goal.
Problem is solved!