我用的是struts2 实现导出文本的功能 xml如下
<result name="success2" type="stream">
<param name="contentType">text/text</param>
<param name="inputName">inputStream2</param>
<param name="contentDisposition">
inline;filename="selectNews.text"
</param>
<param name="bufferSize">1024</param>
</result>
<result name="success2" type="stream">
<param name="contentType">text/text</param>
<param name="inputName">inputStream2</param>
<param name="contentDisposition">
inline;filename="selectNews.text"
</param>
<param name="bufferSize">1024</param>
</result>
解决方案 »
- 毕业设计nutch用tomcat启动时候出现的问题,求助啊
- 请大家推荐一本eclipse开发RMI、CORBA、JMS的书!
- jsp servlet 中传值的问题
- java mail 读取邮件回执
- 很久没做JAVA开发了,最近接到一个项目,请大家指点一下!
- Struts:点提交的时候Action出的错误! 请高手指点!
- 如何在JSP页面取出用户信息
- 请问java有什么组件可以有ie效果的?
- jsp页面导包出错Multiple annotations found at this line:The import dv cannot be
- mybatis拦截器报错找不到类!!! 需求:拦截所有插入修改数据库的操作进行脏字符替换
- html中用Ext写得一段代码错误 如下 解决好了分全给你
- 关于html超链接的问题?????????????????
2009-4-15 8:21:17 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet default threw exception
java.lang.IllegalStateException
at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:407)
at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:707)
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:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:97)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:269)
at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:81)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
2009-4-15 8:21:22 org.apache.tomcat.util.http.Parameters processParameters
java.lang.IllegalStateException
org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:423)经过分析、查看jdk文档终于找到解决的办法,在response.sendRedirect()方法后加return语句即可,如下:
response.sendRedirect("login.jsp");
return;原因是:在程序中两次调用了response.sendRedirect()方法。jdk5.0文档中很清楚地介绍了出现IllegalStateException异常的可能情况:1)同一个页面中再次调用response.sendRedirect()方法。
2)提交的URL错误,即不是个有效的URL。 sendRedirect
void sendRedirect(java.lang.String location)
throws java.io.IOException
Sends a temporary redirect response to the client using the specified redirect location URL. This method can accept relative URLs; the servlet container must convert the relative URL to an absolute URL before sending the response to the client. If the location is relative without a leading '/' the container interprets it as relative to the current request URI. If the location is relative with a leading '/' the container interprets it as relative to the servlet container root.
If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to. Parameters:
location - the redirect location URL
Throws:
java.io.IOException - If an input or output exception occurs
java.lang.IllegalStateException - If the response was committed or if a partial URL is given and cannot be converted into a valid URL
我也碰到了,初步判断是两次提交请求,但是我现在还没解决,这是Struts2的错误,不要拿Struts1的思路解决问题,哪位高手来瞧瞧,我也可以把自己的问题解决啊!
在程序中两次调用了response.sendRedirect()方法。jdk5.0文档中很清楚地介绍了出现IllegalStateException异常的可能情况:1)同一个页面中再次调用response.sendRedirect()方法。
2)提交的URL错误,即不是个有效的URL。
我根本就没这两个方法。而且url 根本不会错!