aspose file tools*
The moose likes Servlets and the fly likes IllegalStateException:........ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "IllegalStateException:........" Watch "IllegalStateException:........" New topic
Author

IllegalStateException:........

Harish Kashyap
Ranch Hand

Joined: Jun 14, 2000
Posts: 118
hi all,
i'm trying to develop an upload-download application through jsp. its giving me following error while downloading.

it says IllegalStateException. basically IOException.
says OutputStream already in use for this request.
what i'm doing is when i click on link, it calls a jsp which reads from a file and writes using the printwriter.
for doing this let's say image download.
i changes the content type of response object to image/gif
then i set the content length attribute. then i write the image using printwriter.
it gives the above mentioned exception.
can ne 1 help me.
thanx
harish
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by Harish Kashyap:
i'm trying to develop an upload-download application through jsp.

Wrong tool for the job. JSPs are only fit to produce text-based output formats. Use servlets. There's no advantage in using a JSP anyway.
You're getting an IllegalStateException because the JSP engine has already obtained a response output stream and wrapped a JspWriter around it. You cannot get a different writer.
- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IllegalStateException:........
 
Similar Threads
very tedious question!
Inserting images on JSP page
RequestDispatcher showing error??
how to download an image
how to retrieve images on a jsp page