jsp中輸出word文件的問題
我在jsp頁面輸出word文件為什麼報錯?
錯誤顯示為:
10:48:01,703 ERROR StandardWrapper[/ygt:jsp]:727 - Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: getOutputStream() has already been called for this response
at org.apache.catalina.connector.Response.getWriter(Response.java:595)
at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:161)
at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:123)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:116)
at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:190)
at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
at org.apache.jsp.customer.show_005fword_005fdoc_jsp._jspService(org.apache.jsp.customer.show_005fword_005fdoc_jsp:61)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
<%@ page contentType="application/msword; charset=gb2312" language="java" errorPage="" %> <html> <head> <meta http-equiv="Content-Type" content="application/msword; charset=gb2312"> <title>無標題文件</title> </head> <body> <% response.reset(); response.setContentType("application/msword"); response.setHeader("Content-disposition","inline; filename=temp.doc"); byte[] word=(byte[])request.getAttribute("scanlist"); javax.servlet.ServletOutputStream os = response.getOutputStream(); os.write(word); os.close(); %> </body> </html> |
錯誤顯示為:
10:48:01,703 ERROR StandardWrapper[/ygt:jsp]:727 - Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: getOutputStream() has already been called for this response
at org.apache.catalina.connector.Response.getWriter(Response.java:595)
at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:161)
at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:123)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:116)
at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:190)
at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
at org.apache.jsp.customer.show_005fword_005fdoc_jsp._jspService(org.apache.jsp.customer.show_005fword_005fdoc_jsp:61)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
相關文章
- JSP生成WORD文件,EXCEL文件,PDF文件JSExcel
- 用jsp直接開啟word的問題!JS
- 在jsp直接代開word的問題!JS
- jsp中javabean的問題JSJavaBean
- jsp中的奇怪問題JS
- IText匯出Word文件
- 在C++程式中匯出Word文件的方法(轉)C++
- 匯出Excel或word文件Excel
- ASP 能都做到,在WEB中編輯WORD 文件!! JSP 如何實現?WebJS
- ACM中的輸入問題ACM
- jsp 的問題JS
- Word文件儲存時常遇到的問題及其解決方
- 關於jsp中轉發的問題JS
- Word 2010文件中輸入鍵盤沒有的符號符號
- 獲取Word文件的作者和主題
- JSP中巢狀struts標籤的問題JS巢狀
- 我在jsp中遇到的亂碼問題!JS
- Java日誌輸出問題Java
- JSP遇到的問題....JS
- JSP問題JS
- jaxb輸出xml檔案的中文問題?XML
- StreamWriter輸出中文亂碼的問題 (轉)
- help:jbuilder中jsp修改後的執行問題UIJS
- Java IO輸入輸出及亂碼問題Java
- 如何解析word文件中的公式內容公式
- html/template 模板range輸出問題HTML
- jsp頁面中中文亂碼問題JS
- 在word文件中全部的文字出現了灰色背景,而且有中括號括起。
- jsp的編碼問題JS
- 在Excel表格中插入Word文件方法Excel
- java web中servlet、jsp、html 互相訪問的路徑問題JavaWebServletJSHTML
- Android中EditText隱藏/自動彈出輸入法的問題Android
- jsp中的rar檔案連線亂碼問題JS
- 有關fastjson輸出的時候double不輸出後面.0的問題ASTJSON
- Java在演算法題中的輸入問題Java演算法
- WPS/Word中公式與文字不對齊的問題公式
- word教程|用自定義屬性功能管理 Word 文件中的待定內容
- PhpWord 如何輸出換行符到 word?PHP