-
Couldn't load subscription status.
- Fork 38.8k
Description
Matthew Sgarlata opened SPR-2607 and commented
In lots of applications you have a view where you display information about an object in a database. In our application, we sometimes allow simple manipulations of that object directly on the display page rather than requiring the user to go to a separate form. I'll attach the screenshot of a screen where a user can view documents. We allow them to upload a new revision of the document directly on that screen. The screen that displays the document is rendered using an AbstractController as the base controller. Uploading a revision is processed by a SimpleFormController which then forwards back to the display screen as its success view. The form:errors and other tags will work fine if I'm coming from the SimpleFormController, but don't work if I'm coming from a plain old AbstractController. It would be very helpful if form tags just generated a WARNing if it can't find the command required rather than blowing up.
ERROR [http-80-Processor25] (ErrorsTag:doStartTag) - Neither Errors instance nor plain target object for bean name 'document' available as request attribute
java.lang.IllegalStateException: Neither Errors instance nor plain target object for bean name 'document' available as request attribute
at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:137)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:165)
at org.springframework.web.servlet.tags.form.ErrorsTag.shouldRender(ErrorsTag.java:83)
at org.springframework.web.servlet.tags.form.AbstractHtmlElementBodyTag.writeTagContent(AbstractHtmlElementBodyTag.java:41)
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.documents.documentsDisplay_jsp._jspx_meth_form_errors_0(documentsDisplay_jsp.java:1198)
at org.apache.jsp.documents.documentsDisplay_jsp._jspService(documentsDisplay_jsp.java:233)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
ERROR [http-80-Processor25] (ViewExceptionInterceptor:afterCompletion) - Error while rendering view
org.apache.jasper.JasperException: Exception in JSP: /documents/documentsDisplay.jsp:71
68: <%-- can't use form:errors because when the screen is first displayed the
69: command object won't be populated
70: --%>
71: <form:errors path="*" cssClass="error"/>
72: <spring:hasBindErrors name="document">
73: <ul class="error">
74: <spring:bind path="document.*">
Stacktrace:
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:112)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:248)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1055)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:819)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:728)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.spider.cms.framework.ContentTypeFilter.doFilterInternal(ContentTypeFilter.java:125)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at net.sf.morph.web.MorphFilter.doFilter(MorphFilter.java:43)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.spider.cms.framework.springx.AvailableResourceFilter.doFilterInternal(AvailableResourceFilter.java:110)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.spider.cms.framework.RequestLogFilter.doFilter(RequestLogFilter.java:38)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Affects: 2.0 RC4
Attachments:
- screenshot.jpg (224.31 kB)
Issue Links:
- Allow null as modelAttribute on form:form binding [SPR-5867] #10536 Allow null as modelAttribute on form:form binding
- Option to expose empty value instead of NullValueInNestedPathException [SPR-1671] #6368 Option to expose empty value instead of NullValueInNestedPathException
0 votes, 5 watchers