out in catch block is jsp built in object.

I am using in JSP file
Even if I comment the line 
out.println
in catch block I am getting same exception
:Illegal state exception
How can we avoid this

[EMAIL PROTECTED] wrote
What is 'out' in you catch-phrase?
Is it a PrintWriter you got like this:
PrintWriter out = response.getPrintWriter()

Calling getOutputStream() after calling getPrintWriter()
is illegal. That is what I tried to explain in an earlier
mail...

Get rid of this PrintWriter and your code will work.
(Of course I am not clairvoyant; if this 'out' is just
System.err or System.out, there's probably something else
wrong).

Bruno

Quoting [EMAIL PROTECTED]:

> I tried as below
> try {
>               response.setContentType("application/pdf");
>               //out.println("First Line");
>               Document document=null;
>               ByteArrayOutputStream ba =null;
>               document = new Document();
>               ba = new ByteArrayOutputStream();
>               
>           PdfWriter.getInstance(document, ba);
>             document.open();
>             document.add(new Paragraph("Hello World"));
>                document.close();
> 
>               response.setContentLength(ba.size());
>                ServletOutputStream out1 = response.getOutputStream();
>                ba.writeTo(out1);
>                out1.flush();
> 
> 
>       
                }
> catch(Exception e) {
>             out.println(e.getMessage());
>         }



-------------------------------------------------------
This sf.net email is sponsored by: DEDICATED SERVERS only $89!
Linux or FreeBSD, FREE setup, FAST network. Get your own server 
today at http://www.ServePath.com/indexfm.htm
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to