<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    紙飛機

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      22 隨筆 :: 28 文章 :: 30 評論 :: 0 Trackbacks

    2008年6月2日 #

    用jspsmart下載文件異常(tomcat正常,weblogic不行)

    用jspsmart下載文件JSP代碼如下:
    <%@ page contentType="text/html;charset=GBK" import="com.jspsmart.upload.*" %><%
    //取得服務器存放文件的路徑
    String reportTemplatePath = (String)session.getAttribute("reportTemplatePath");
    //文件名
    String filename = reportTemplatePath + "/" + request.getParameter("filename");
    filename = new String(filename.getBytes(),"ISO-8859-1");
    // 新建一個SmartUpload對象
    SmartUpload su = new SmartUpload();
    // 初始化
    su.initialize(pageContext);
    //設定contentDisposition為null以禁止瀏覽器自動打開文件,保證點擊鏈接后是下載文件。若不設定,則下載的文件擴展名為
    //doc時,瀏覽器將自動用word打開它。擴展名為pdf時,瀏覽器將用acrobat打開。
    su.setContentDisposition(null);
    // 下載文件
    su.downloadFile(filename);
    %>在tomcat中運行正常。
    在weblogic中運行拋出如下異常.
    文件可以下載,但特別慢并且打開是亂碼。
    <2004-2-19 下午09時14分34秒> <Error> <HTTP> <101019> <[ServletContext(id=325867,
    name=csrc,context-path=/csrc)] Servlet failed with IOException
    java.net.ProtocolException: Exceeded stated content-length of: '548352' bytes
            at weblogic.servlet.internal.ServletOutputStreamImpl.checkCL(ServletOutp
    utStreamImpl.java:220)
            at weblogic.servlet.internal.ServletOutputStreamImpl.write(ServletOutput
    StreamImpl.java:170)
            at com.jspsmart.upload.SmartUpload.downloadFile(SmartUpload.java:986)
            at com.jspsmart.upload.SmartUpload.downloadFile(SmartUpload.java:355)
            at com.jspsmart.upload.SmartUpload.downloadFile(SmartUpload.java:336)
            at jsp_servlet._test.__do_download._jspService(__do_download.java:102)
            at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
            at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
    (ServletStubImpl.java:1058)
            at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:401)
            at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:306)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:5445)
            at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
    eManager.java:780)
            at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:3105)
            at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2588)
            at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
            at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
    >

    解決方法:把所有<%和%>之外的空格字符都取掉就好了.參考如下:
    <%@ page contentType="text/html;charset=GBK" import="com.jspsmart.upload.*" %><%
    //取得服務器存放文件的路徑
    String reportTemplatePath = (String)session.getAttribute("reportTemplatePath");
    //文件名
    String filename = reportTemplatePath + "/" + request.getParameter("filename");
    filename = new String(filename.getBytes(),"ISO-8859-1");
    // 新建一個SmartUpload對象
    SmartUpload su = new SmartUpload();
    // 初始化
    su.initialize(pageContext);
    //設定contentDisposition為null以禁止瀏覽器自動打開文件,保證點擊鏈接后是下載文件。若不設定,則下載的文件擴展名為
    //doc時,瀏覽器將自動用word打開它。擴展名為pdf時,瀏覽器將用acrobat打開。
    su.setContentDisposition(null);
    // 下載文件
    su.downloadFile(filename);
    %>

     

    posted @ 2008-06-02 16:04 紙飛機 閱讀(3798) | 評論 (2)編輯 收藏

    主站蜘蛛池模板: 高潮毛片无遮挡高清免费视频| 免费观看91视频| 亚洲日韩乱码中文无码蜜桃臀网站| 久久精品无码精品免费专区| 亚洲国产午夜精品理论片| 天天摸天天碰成人免费视频| 四虎影视久久久免费| 久久亚洲精品成人无码网站| 四虎在线视频免费观看| 国产色爽免费无码视频| 亚洲精品天堂在线观看| 亚洲人成色7777在线观看不卡| 99xxoo视频在线永久免费观看| 精品久久亚洲一级α| 亚洲av激情无码专区在线播放| 毛片免费视频在线观看| XXX2高清在线观看免费视频| 亚洲偷偷自拍高清| 精品国产亚洲一区二区三区 | 99爱在线观看免费完整版 | 污视频在线观看免费| 亚洲国产精品成人AV在线| 国产亚洲综合一区柠檬导航| 精品无码国产污污污免费| 日韩免费在线视频| 五月婷婷免费视频| 精品久久久久久亚洲精品| 亚洲精品无码永久在线观看你懂的| 我的小后妈韩剧在线看免费高清版 | 亚洲中文字幕无码爆乳av中文 | heyzo亚洲精品日韩| 久久久久久久免费视频| 日韩精品无码免费专区网站| 在线观看亚洲免费| 亚洲精品免费在线视频| 国产亚洲精品免费视频播放| 最近最好的中文字幕2019免费| 免费在线看黄网站| 国产免费A∨在线播放| 国产成人亚洲综合a∨| 亚洲va精品中文字幕|