尝试在JSP中提交表单时获取IllegalArgumentException

时间:2017-04-25 14:39:54

标签: java jsp spring-mvc

尝试在JSP中提交表单时,我收到了IllegalArgumentException。我试图将此请求路由到spring mvc控制器。虽然信息很清楚,但我不明白需要改变什么。 这是异常跟踪 -

Apr 25, 2017 9:29:29 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [EWeb] in context with path [/EWeb] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: argument type mismatch HandlerMethod details: Controller [com.test.pm.crequest.web.NewRequestController] Method [protected void com.test.pm.crequest.web.NewRequestController.onSubmitAction(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,java.lang.Object,org.springframework.validation.BindException) throws java.lang.Exception] Resolved arguments: [0] [type=org.apache.catalina.connector.RequestFacade] [value=org.apache.catalina.connector.RequestFacade@102ab327] [1] [type=org.apache.catalina.connector.ResponseFacade] [value=org.apache.catalina.connector.ResponseFacade@4e25c43b] [2] [type=java.lang.Object] [value=java.lang.Object@9ebd244] [3] [type=org.springframework.validation.BeanPropertyBindingResult] [value=org.springframework.validation.BeanPropertyBindingResult: 0 errors] ] with root cause

1 个答案:

答案 0 :(得分:0)

我将onSubmitMethod中的参数更改为:

protected String onSubmitAction(HttpServletRequest request,
        HttpServletResponse response, @ModelAttribute CRequestForm command, BindingResult errors)
        throws Exception {

问题已解决。