File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes pagecontext release problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "pagecontext release problem" Watch "pagecontext release problem" New topic

pagecontext release problem

Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

I am experience the following error:

around the following code:

any hints??
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63854

Are you sure that the exception is a result of the line with the release call in it? If you are relying on JSP line numbers reported in a stack trace, that's notorious for being almost right, but not quite.
Perhaps you could show us a few lines of code before and after where you think the problem is. Also the full stack trace never hurts.
And, are you calling getOutputStream() anywhere in your JSP code tree?

[Asking smart questions] [About Bear] [Books by Bear]
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

You can't use getOutputStream and then do something that causes getPrintWriter to be called. This is what happens when you try to forward to /minnaqua/minnaquaFramesetMain.jsp
Binary output from JSPs is a little tricky. You need to be sure your'e going to use the OutputStream before you call it. You can't call it and then decide to send character data via the PrintWriter. This is not allowed.
You also need to be careful not to accidentally output character data before the OutputStream is called, since this will call the PrintWriter and you will not be allowed to call the OutputStream.
It fits better in a Servlet.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

I forgot to mention that you'll get the same error if you have white space at the end of your JSP or if your JSP throws an Exception and attempts to forward to your error page.
I agree. Here's the link:
subject: pagecontext release problem
It's not a secret anymore!