Hello folks,
It appears to me that Spring MVC cannot bind properties of primitive wrapper types(e.g. Integer, Boolean, etc). When it tries to bind such properties, it throws the following exception.
javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: org.springframework.beans.NotReadablePropertyException: Invalid property 'assigned' of bean class [model.domain.Employee]: Bean property 'assigned' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.WEB_002dINF.jsp.configuration.form.defaultForm_jsp._jspService(defaultForm_jsp.java:87)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1063)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:801)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.tiles.web.startup.TilesFilter.doFilter(TilesFilter.java:75)
As soon as I changed the type of the 'assigned' property(getter, setter and instance variable) from Boolean to boolean, it worked fine.
Can anyone confirm Spring MVC cannot bind properties of primitive wrapper types? If so, is there any workaround? I can't change the property type to boolean because a null value in this property means something for my application.
Thanks.