Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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


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
 
GeeCON Prague 2014
 
subject: IllegalStateException:........