JSP 文件下载时出现:Cannot forward after response has been committedjava.lang.IllegalStateException:Cannot forward after response has been committed\x05at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:339
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/23 15:13:58
JSP 文件下载时出现:Cannot forward after response has been committedjava.lang.IllegalStateException:Cannot forward after response has been committed\x05at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:339
JSP 文件下载时出现:Cannot forward after response has been committed
java.lang.IllegalStateException:Cannot forward after response has been committed
\x05at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:339)
\x05at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
\x05at org.apache.jsp.get_005fycfxbg_jsp._jspService(get_005fycfxbg_jsp.java:939)
\x05at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
\x05at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
\x05at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
\x05at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
\x05at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
\x05at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
\x05at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
\x05at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
\x05at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
\x05at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
\x05at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
\x05at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
\x05at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
\x05at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
\x05at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
\x05at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
\x05at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:284)
\x05at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:322)
\x05at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1714)
\x05at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
\x05at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
\x05at java.lang.Thread.run(Thread.java:619)
JSP 文件下载时出现:Cannot forward after response has been committedjava.lang.IllegalStateException:Cannot forward after response has been committed\x05at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:339
假设你用response.sendRedirect();跳转页面,执行这个语句之后,他的后面还有代码没有执行,你想想,既然跳转了页面,原页面的代码没有终止,一定会出错,这时就会出现你的错误Cannot forward after response has been committed.
解决方法,在response.sendRedirect();后面加 return;
如果不是这个问题的话,你贴下相关代码