Two Laptop Bag*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "pagecontext release problem" Watch "pagecontext release problem" New topic
Author

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
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

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?
hth,
bear


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

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.
Dave
David O'Meara
Rancher

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: pagecontext release problem
 
Similar Threads
Can't cast JspContext to PageContext ???
question about JSP..
Problem with JBOSS Server
about pageContext in jsp
isELIgnored attribute