晕,有这样提问的吗??jspSmartUpload我前两天才做了上传,下载,处理中文问题,
你说你的情况,

解决方案 »

  1.   

    to dkmilk(迪克牛奶____来一杯?) :
    不知你做下载时有没有试过下载XML文件的情况!我的代码如下:
    <%@ page contentType="text/html;charset=gb2312" import="com.jspsmart.upload.*" %>
    <%
    // response.sendRedirect("/upload/yuehai.rar");
    // out.print("您忆经下载成功!"); String xmlFile = "/xmlfile/idenfee/wsq1.xml";
    // xmlFile = "/xmlfile/idenfee/aaa.xml";

    // 新建一个SmartUpload对象
    SmartUpload su = new SmartUpload();
    // 初始化
    su.initialize(pageContext);
    // 设定contentDisposition为null以禁止浏览器自动打开文件,
    //保证点击链接后是下载文件。若不设定,则下载的文件扩展名为
    //doc时,浏览器将自动用word打开它。扩展名为pdf时,
    //浏览器将用acrobat打开。
    su.setContentDisposition(null);
    // 下载文件
    %>
    <script language="javascript">
    // alert("<%=xmlFile%>");
    </script>
    <%
    // su.downloadFile(xmlFile); su.downloadFile(xmlFile,"xml","idenfee.xml");
    %>
    当wsq1.xml有n条记录即足够大(多大?还没有找准),才能下载,好果形如:
    <?xml version="1.0" encoding="gbk"?>
    <SEGSEC>
    <IdenFee id="0">
    <CARNO>
    粤B.Z2033
    </CARNO>
    <BEGINTIME>
    2004-03-30 21:14:20.0
    </BEGINTIME>
    <ENDTIME>
    2004-03-30 21:34:35.0
    </ENDTIME>
    <PRIC>
    240
    </PRIC>
    <RUNLEN>
    10645
    </RUNLEN>
    <TIMENUM>
    141
    </TIMENUM>
    <RUNMONEY>
    3290
    </RUNMONEY>
    <NULLEN>
    150
    </NULLEN>
    <NULSTOPNUM>
    0
    </NULSTOPNUM>
    <NULSTOPSTAMP>
    0
    </NULSTOPSTAMP>
    <OVERSPLEN>
    0
    </OVERSPLEN>
    <OVERSPNUM>
    586
    </OVERSPNUM>
    <PERMITNO>
    280000AA
    </PERMITNO>
    <SAMECARD>
    0000000000000000
    </SAMECARD>
    <NOWMONEY>
    0
    </NOWMONEY>
    <NEXTMONEY>
    0
    </NEXTMONEY>
    <ONLON>
    113.9309
    </ONLON>
    <ONLAT>
    22.5441
    </ONLAT>
    <OFFLON>
    113.9545
    </OFFLON>
    <OFFLAT>
    22.5742
    </OFFLAT>
    <ONCURSE>
    null
    </ONCURSE>
    <OFFCURSE>
    null
    </OFFCURSE>
    <PASSAGERNUM>
    null
    </PASSAGERNUM>
    <PAYNO>
    null
    </PAYNO>
    </IdenFee>
    </SEGSEC>即一条记录或没有记录,下载时就提示如下错误:
    type Exception reportmessage 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:611)
    org.apache.coyote.tomcat5.CoyoteResponseFacade.getWriter(CoyoteResponseFacade.java:190)
    org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:165)
    org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:158)
    org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:235)
    org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:160)
    org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:120)
    org.apache.jsp.test.XML.downloadxml_jsp._jspService(downloadxml_jsp.java:83)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    note The full stack trace of the root cause is available in the Tomcat logs.