wood burning stoves 2.0*
The moose likes JSP and the fly likes How to get errors in jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to get errors in jsp page" Watch "How to get errors in jsp page" New topic
Author

How to get errors in jsp page

Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 349
when i get a http 500 error, i want to set something on the session, i dont want to have a errorpage, i want to catch the error in the jsp page is this possible i have tryed too put a try catch around the whole thing, but nothing happens, any ideas out there ???


Frank
[ April 17, 2007: Message edited by: Bear Bibeault ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Try/catch blocks work in JSPs.
It's not really a best practice to put Javacode in to JSPs but that's another issue.

Post your code with the try/catch block that's not working.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
vijay kokatnur
Greenhorn

Joined: Apr 18, 2007
Posts: 1
Add the following in web.xml
<error-page>
<error-code>500</error-code>
<location>/ErrorDisplay.jsp</location>
</error-page>


You can continue with your session operations in errordisplay.jsp!!

Hope that works.
 
 
subject: How to get errors in jsp page