java Struts2 在拦截器里的跳转问题

复制代码 代码如下:
Java.lang.IllegalStateException
at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.Java:405)
at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.Java:725)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.Java:488)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.Java:467)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.Java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.Java:188)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.Java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.Java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.Java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.Java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.Java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.Java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.Java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.Java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.Java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.Java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.Java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.Java:665)
at org.apache.tomcat.util.NET.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.Java:528)
at org.apache.tomcat.util.NET.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.Java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.Java:689)
at Java.lang.Thread.run(Thread.Java:595)


网上一查,是说页面两次调用了response.sendRedirect()方法,在后面加了一个return null 后,问题成功解决。

因此想,应该在页面跳转时如果报同类型的异常,应该可以用同种方法解决。

jsp技术java Struts2 在拦截器里的跳转问题,转载需保留来源!

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。