关于在前台用ajax调用struts,action用完PrintWriter输出之后出现的异常

前端之家收集整理的这篇文章主要介绍了关于在前台用ajax调用struts,action用完PrintWriter输出之后出现的异常前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
错误信息如下
Nov 24,2012 6:43:17 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [default] in context with path [] threw exception
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed
at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:451)
at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:752)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:505)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
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:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
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:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
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:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
现在解决方法总结如下:
<span style="color: rgb(51,51,51); font-family: Helvetica,Tahoma,Arial,sans-serif; font-size: 14px; line-height: 24px; background-color: rgb(245,245,245);">1.servlet或jsp中,重复调用response的getOutputStream(),response.getWriter()方法,特别是用完之后没关闭然后又调用</span><br style="Box-sizing: content-Box; color: rgb(51,245);" /><span style="color: rgb(51,245);">2.form表单里没有method="post"action=""参数</span><br style="Box-sizing: content-Box; color: rgb(51,245);">3.看JDBC操纵数据库代码,仔细看,例如调用的对象的属性为null。</span><br style="Box-sizing: content-Box; color: rgb(51,245);">Connectionconn=null;之后之就调用了conn.??的方法</span>
原文链接:https://www.f2er.com/ajax/164503.html

猜你在找的Ajax相关文章