這在我看來,Spring MVC中不能結合(例如整型,布爾等),原始包裝類型的屬性。當它試圖綁定這些屬性時,它會拋出以下異常。結合特性
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)
只要我改變從布爾「分配」屬性器(getter,setter和實例變量)爲布爾值的類型,它工作得很好。
任何人都可以證實的Spring MVC不能綁定基本類型的包裝類型的屬性?如果是這樣,是否有任何解決方法?我無法將屬性類型更改爲布爾值,因爲此屬性中的空值表示我的應用程序的某些內容。
謝謝。