既不是BindingResult也不是bean名称的明确目标对象' newCase'可用作请求属性

时间:2014-08-01 19:47:41

标签: java spring spring-mvc

我一直在阅读有关此错误的每个页面,我无法弄明白。我正在做的是为我所拥有的相当大的形式创建一个表单支持对象。

此表单的目的(作为Bootstrap模式实现)是允许用户在数据库表中输入新条目。表单本身位于/main页面上。用户单击添加按钮,这将使模式显示。然后,他们进入所有字段,单击“保存”,然后对/add进行AJAX POST,控制器应该抓取数据并使用数据填充SpecialClaimsCase对象从形式。

表单定义为:

<form:form commandName="newCase" method="post">

呈现表单所在页面的控制器方法:

@RequestMapping(value="/main", method=RequestMethod.GET)
public ModelAndView view() {
    return new ModelAndView("application");
}

处理表单提交的控制器方法:

@RequestMapping(value="/add", method=RequestMethod.POST)
public void addRow(@ModelAttribute("newCase") SpecialClaimsCase newCase) {
    caseManager.addNewSpecialClaimsCase(newCase);
}

一旦我加载表单所在的页面,我就会收到以下错误:

  

[8/1/14 14:32:17:866 CDT] 0000001f webapp E.   com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E:   [Servlet Error] - [dispatcher]:java.lang.IllegalStateException:都不是   BindingResult也不是bean名称的简单目标对象&#39; newCase&#39;   可用作请求属性   org.springframework.web.servlet.support.BindStatus。(BindStatus.java:141)     在   org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:168)     在   org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:188)     在   org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:154)     在   org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:117)     在   org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:422)     在   org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142)     在   org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:84)     在   org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80)     在   com.ibm._jsp._application._jspx_meth_form_input_0(_application.java:626)     在com.ibm._jsp._application._jspService(_application.java:191)at   com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)at   javax.servlet.http.HttpServlet.service(HttpServlet.java:668)at at   com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1214)     在   com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)     在   com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)     在   com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)     在   com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)     在   com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:205)     在   com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:125)     在   com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)     在   com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:926)     在   com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1023)     在   com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1384)     在   com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:193)     在   org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209)     在   org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:266)     在   org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1225)     在   org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1012)     在   org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)     在   org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)     在   org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:931)     在   org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:822)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:575)at   org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:668)at   com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1214)     在   com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)     在   com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)     在   com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)     在   com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:125)     在   com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:330)     在   org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)     在   org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)     在   org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)     在   org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)     在   org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)     在   org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)     在   com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192)     在   com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)     在   com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:926)     在   com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1023)     在   com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)     在   com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:895)     在   com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)     在   com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)     在   com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)     在   com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)     在   com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)     在   com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)     在   com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)     在   com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)     在   com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)     在com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)at at   com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)at at   com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)     在com.ibm.io.async.ResultHandler $ 2.run(ResultHandler.java:905)at   com.ibm.ws.util.ThreadPool $ Worker.run(ThreadPool.java:1659)

这里是fpaste link,因为这里的回溯非常难以理解。

我非常被困在这里。就此而言,Spring文档非常简单。我找到了一个引用这种情况的句子,我跟着他们说的话。依然没有。所以任何帮助将不胜感激。谢谢!

0 个答案:

没有答案