Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get errors in jsp page

 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
vijay kokatnur
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic