日期:2014-05-18  浏览次数:20842 次

如何在jsp中用smartupload实现下载
上传已经实现了啊。、、就是下载老出错!!
<%@ page contentType="text/html; charset=gb2312" language="java" 
import="java.util.*,org.lxh.smart.*,java.sql.*" errorPage="" %>
<jsp:useBean id="smart" scope="page" class="org.lxh.smart.SmartUpload">
</jsp:useBean>
<%
  
  SmartUpload su = new SmartUpload ();
  // 初始化
  su.initialize(pageContext);

 su.setContentDisposition(null);
  // 下载文件
 su.downloadFile("g:/11.txt");
%>
运行出错、、、


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

exception 

org.apache.jasper.JasperException: java.lang.IllegalStateException: getOutputStream() has already been called for this response
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:410)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

怎么回事???


------解决方案--------------------
Java code
<% 
  out.clearBuffer(); // 增加这么一句
  SmartUpload su = new SmartUpload ();
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.aiyiweb.com/java-web/317.html