Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 18th, 2003, 08:51 PM
Registered User
 
Join Date: Aug 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default i am new in java and JSP...pls help!

i am new in java and JSP...pls help!
i have write a JSP program using itext library to generate a PDF file...
i can running very well in windows with Tomcat server only,
but when i running in Linux(Apache+tomcat), It have following errors!!

//error message
org.apache.jasper.JasperException: getOutputStream() has already been called for this response at
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:2
54)
at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:241)

and my source code is under below!!Anyone can tell me what 's wrong or solution??

//source code

<%@
page import="java.io.*,
    com.lowagie.text.*,
    com.lowagie.text.pdf.*"
errorPage="error.jsp"
%><%


response.setContentType( "application/pdf" );


Document document = new Document();



ByteArrayOutputStream buffer = new ByteArrayOutputStream();
PdfWriter.getInstance( document, buffer );

document.open();

document.add(new Paragraph("Hello World"));

document.close();

DataOutput output = new DataOutputStream( response.getOutputStream() );
byte[] bytes = buffer.toByteArray();
response.setContentLength(bytes.length);
for( int i = 0; i < bytes.length; i++ ) { output.writeByte( bytes[i] ); }
%>







Similar Threads
Thread Thread Starter Forum Replies Last Post
Struts 2.2, Json data and jsp problem, help pls ish Struts 0 July 8th, 2008 04:59 AM
Ajax + Java (Jsp) nigam.anand BOOK: Professional Ajax ISBN: 978-0-471-77778-6 6 January 18th, 2007 12:19 PM
Java is killing me!! Pls Help!!!! il nonno Java Basics 7 September 24th, 2006 10:29 PM
java and jsp harshika Apache Tomcat 1 August 6th, 2005 05:15 PM
java/jsp and MySQL harshika Java Databases 2 August 2nd, 2005 02:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.