首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

看了很多贴子,总解决不了smrt下载有关问题

2013-09-11 
看了很多贴子,总解决不了smrt下载问题eExceptionreportmessagedescriptionTheserverencounteredaninternal

看了很多贴子,总解决不了smrt下载问题
e   Exception   report

message  

description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception  

java.lang.IllegalStateException:   getOutputStream()   has   already   been   called   for   this   response
org.apache.coyote.tomcat5.CoyoteResponse.getWriter(CoyoteResponse.java:599)
org.apache.coyote.tomcat5.CoyoteResponseFacade.getWriter(CoyoteResponseFacade.java:163)
org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:122)
org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115)
org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:190)
org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)
org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
org.apache.jsp.admin.downloadfile_jsp._jspService(downloadfile_jsp.java:67)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Apache   Tomcat/5.0.28   logs.


[解决办法]
<%@ page language= "java " contentType= "text/html; charset=UTF-8 "
pageEncoding= "gb2312 " import= "com.jspsmart.upload.* "%>
<%
String fileName = (session.getAttribute( "fileName ")).toString();
response.addHeader( "Content-Disposition ", "attachment;filename= "
+ fileName);
System.out.println( "dddfgg " + fileName);
SmartUpload su = new SmartUpload(); //新建一个SmartUpload对象 并初始化
su.initialize(pageContext);
su.setContentDisposition(null);
su.downloadFile(fileName);
%>


下载页面。response.addHeader( "Content-Disposition ", "attachment;filename= "
+ fileName);这句看贴加的也没用。

我又把fileName直接写成路径f:/fileupload/70514232733593.txt 还是不行,试这改长度,又出现我download.jsp页面
[解决办法]
<%@ page language= "java " contentType= "text/html; charset=UTF-8 "
pageEncoding= "gb2312 " import= "com.jspsmart.upload.* "%>
<%
SmartUpload su = new SmartUpload(); //新建一个SmartUpload对象 并初始化
su.initialize(pageContext);
su.setContentDisposition(null);
String fileName = (session.getAttribute( "fileName ")).toString();///最好不要把什么东西都往session中塞
su.downloadFile(fileName);
%>
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html

热点排行