无法在春季从一个控制器向另一个控制器发送请求

时间:2014-02-03 15:17:14

标签: spring spring-mvc dispatcher

我已经使用requestdispatcher将我的请求从一个控制器发送到另一个控制器但是当它运行时它会进入basictilesdef并给我错误 这是源控制器代码

public ModelAndView forwardRequest(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse) throws Exception 
{
    //String urlToForward=httpServletRequest.getParameter("urlToForward");
    httpServletRequest.getRequestDispatcher("postQuery.htm?actionCode=answerQuery%26queryListStatus=ANS%26strKey=90302140000326").forward(httpServletRequest, httpServletResponse);
    LoginForm loginForm = new LoginForm();      
    return new ModelAndView("homePage", "loginForm", loginForm);
}

我得到的错误是

03/02/2014 20:34:07 ERROR PortalExceptionResolver:43] Exception ID (MESSAGE_KEY) : 1391439847740 : Request processing failed; nested exception is org.apache.tiles.definition.NoSuchDefinitionException: postQuery
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.tiles.definition.NoSuchDefinitionException: postQuery
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:583)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at sun.reflect.GeneratedMethodAccessor289.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at net.bull.javamelody.JspWrapper.invoke(JspWrapper.java:151)
    at net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(JdbcWrapper.java:282)
    at $Proxy34.forward(Unknown Source)
    at com.tcs.kra.tps.portal.controller.common.MainController.forwardRequest(MainController.java:1255)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:473)
    at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:410)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:203)
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:181)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.tiles.definition.NoSuchDefinitionException: postQuery
    at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:578)
    at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:246)
    at org.springframework.web.servlet.view.tiles2.TilesView.renderMergedOutputModel(TilesView.java:75)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:257)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1183)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:902)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)

1 个答案:

答案 0 :(得分:2)

postQuery.htm

请参阅错误导致Tiles文件中没有声明Tiles定义(apache tiles配置文件) 参考:struts 2 tiles NoSuchDefinitionException 我认为你必须检查你的瓷砖定义