This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Error handling JSP page  RSS feed

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,..

Firstly i have the error page declared in web.xml



Since the error type is Exception, i assumed it handles all the exceptions.

I was testing and this is what happened:

I was going thru the web application; logged off (session is expired) and
using browser Back button i somehow came to a an URL and pressed enter and surprising this jsp page was not called when a NullPointerException happened, and in the browser i have a page showing HTTP 500 , internal Server error ???

So should i also add



to web.xml to handle this?? I will also test by adding this HTTP err code and see where it goes..

Your ideas on this; Appreciate your help;
Thanks again


PS: How do you guys do error handling and what is the best way..
[ December 16, 2005: Message edited by: Bear Bibeault ]
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you will have to add different <error-page> tags for different type of errors (500,404 ..etc).

and the error-page in your web.xml handles the situations when there is an exception only (from your application code).

And moreover when you said you clicked the browser's back button and then clicked enter, you got null pointer exception.. that might not be actually a null pointer exception ... since the session has expired, it could not redirect you to the next page which is not due to any exception generated.

and you can aswell display different pages for different types of errors.

Hope that helps.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!