Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IllegalStateException:........

 
Harish Kashyap
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic