看了很多贴子,总解决不了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.aiyiweb.com/java-web/317.html