当前位置: 技术问答>java相关
生成PDF数据流到客户端,在wsad下调试有错误,高手帮忙!!
来源: 互联网 发布时间:2017-04-05
本文导语: 文件名printtest.jsp 调试运行报错: baos.writeTo(pout);执行异常. 完整代码如下: printtest.jsp | 照你写的,我试了一下,结果为: %PDF-1.4 %噌忏 3 0 obj stream x渳?? 厵} 弨攂'8?0Cs蕪勀@梌'乀 E杔+~锍C...
文件名printtest.jsp
调试运行报错:
baos.writeTo(pout);执行异常.
完整代码如下:
printtest.jsp
调试运行报错:
baos.writeTo(pout);执行异常.
完整代码如下:
printtest.jsp
|
照你写的,我试了一下,结果为:
%PDF-1.4 %噌忏 3 0 obj stream x渳?? 厵} 弨攂'8?0Cs蕪勀@梌'乀 E杔+~锍C萮 ?洼^?矯q尀轿讜緽ч顴蒬焷0唈r???d售帠???.i礧??娉錞,翪跗趌4>趾lJ廰埄薂?贪(?罵仚?7侫?endstream endobj 4 0 obj /ProcSet [/PDF /Text] >> /MediaBox [0 0 595 842] >> endobj 5 0 obj >> endobj 6 0 obj /Subtype /CIDFontType0 /Type /Font /W [11[423]] >> endobj 2 0 obj endobj 1 0 obj endobj 7 0 obj endobj 8 0 obj endobj xref 0 9 0000000000 65535 f 0000000934 00000 n 0000000800 00000 n 0000000015 00000 n 0000000256 00000 n 0000000412 00000 n 0000000618 00000 n 0000000990 00000 n 0000001038 00000 n trailer startxref 1149 %%EOF
Error: 500
Location: /test/pdf.jsp
Internal Servlet Error:
java.lang.IllegalStateException: OutputStream is already being used for this request
at org.apache.tomcat.facade.HttpServletResponseFacade.getWriter(HttpServletResponseFacade.java:177)
at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:166)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:158)
at org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:205)
at _0002fpdf_0002ejsppdf_jsp_30._jspService(_0002fpdf_0002ejsppdf_jsp_30.java:148)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:536)
%PDF-1.4 %噌忏 3 0 obj stream x渳?? 厵} 弨攂'8?0Cs蕪勀@梌'乀 E杔+~锍C萮 ?洼^?矯q尀轿讜緽ч顴蒬焷0唈r???d售帠???.i礧??娉錞,翪跗趌4>趾lJ廰埄薂?贪(?罵仚?7侫?endstream endobj 4 0 obj /ProcSet [/PDF /Text] >> /MediaBox [0 0 595 842] >> endobj 5 0 obj >> endobj 6 0 obj /Subtype /CIDFontType0 /Type /Font /W [11[423]] >> endobj 2 0 obj endobj 1 0 obj endobj 7 0 obj endobj 8 0 obj endobj xref 0 9 0000000000 65535 f 0000000934 00000 n 0000000800 00000 n 0000000015 00000 n 0000000256 00000 n 0000000412 00000 n 0000000618 00000 n 0000000990 00000 n 0000001038 00000 n trailer startxref 1149 %%EOF
Error: 500
Location: /test/pdf.jsp
Internal Servlet Error:
java.lang.IllegalStateException: OutputStream is already being used for this request
at org.apache.tomcat.facade.HttpServletResponseFacade.getWriter(HttpServletResponseFacade.java:177)
at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:166)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:158)
at org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:205)
at _0002fpdf_0002ejsppdf_jsp_30._jspService(_0002fpdf_0002ejsppdf_jsp_30.java:148)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:536)
|
如果真的要用JSP实现的话,需要去掉JSP页面上所有的其他out输出。
如你的程序中的:
printtest.jsp
以及
到
如你的程序中的:
printtest.jsp
以及
到