2013-05-15 2 views
1

컨트롤러에 IllegalStateException이 발생합니다. 내 컨트롤러의 매핑 및 서명은 여기에 관련되어 있습니다.Spring 3 - IllegalStateException

@RequestMapping(value = "/poll1", method = RequestMethod.POST) 
public String processPoll1(@RequestParam String vote, Model model, BindingResult result) { 

내 BindingResult 인수가 내 Model 인수를 분명히 따르더라도 다음 오류가 발생합니다.

java.lang.IllegalStateException: An Errors/BindingResult argument is expected to be immediately after the model attribute argument in the controller method signature: public java.lang.String com.controller.PollController.processPoll1(java.lang.String,org.springframework.ui.Model,org.springframework.validation.BindingResult) 
    at org.springframework.web.method.annotation.ErrorsMethodArgumentResolver.resolveArgument(ErrorsMethodArgumentResolver.java:62) 
    at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:75) 
    at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:156) 
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:117) 
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) 
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:647) 
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:603) 
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) 
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950) 
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:859) 
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:883) 
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:792) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164) 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) 
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562) 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395) 
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250) 
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188) 
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at java.lang.Thread.run(Unknown Source) 
+0

왜 매개 변수에 모델이 필요합니까? 메서드에서 모델을 만들 수 없습니까? 그래서 같은 것을 만드세요 ->'(@RequestParam String vote, BindingResult result)' –

+0

방금 ​​모델을 제거하려고했지만 동일한 오류 메시지가 나타납니다. 또한 Model을 사용하여 쿠키를 JSP로 반환하므로 실제로 사용하게됩니다. –

+0

모델을 전달하지 않아도되지만 설정 쿠키로 모델을 반환 할 수는 있습니다. HTH –

답변