java.lang.IllegalStateException: output stream already obtained

Angins

Mitglied
Hallo zusammen,

Ich habe eine Jsp die dauernd folgende Exception aufwirft:
java.lang.IllegalStateException: output stream already obtained

Mein Code sieht folgendermassen aus:
Code:
try {
   PdfWriter docWriter = null;
   Document document = new Document(PageSize.A4, 32, 32, 22, 32);
   ServletOutputStream out2 = response.getOutputStream();
  
 try { 

    docWriter = PdfWriter.getInstance(document, out2);
    ..........
 }
 finally {
   out2.flush();
  document.close(); 
  docWriter.flush();		
  docWriter.close();
 }
}

Weiss jemand weshalb diese Exception aufgerufen wird?

Vielen Dank im voraus.

Gruss
Angins
 
Zuletzt bearbeitet:
Hi !

Aus der IText Doku :

It's always a bad idea to use JSPs to generate binary data that has to be sent to a client application. I repeat: It's always a bad idea to use JSPs to generate binary data that has to be sent to a client application. I hope you understand that it's always a bad idea to use JSPs to generate binary data that has to be sent to a client application.
OK? Now that you know that, I'll give you a small example of a JSP that generates a PDF file using iText.

Hier ist ein Beispiel, wie mans macht :

http://itextdocs.lowagie.com/tutorial/general/webapp/


Gruss,
Krösi
 
Zurück