• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting the request object with error information  RSS feed

 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My book says -
"The servlet throwing an exception can set the following details regarding the error using the setAttribute() method in the HttpServletRequest interface:
- Status code for javax.servlet.error.status_code
- Exception type for javax.servlet.error.exception_type
- Message for javax.servlet.error.message
The error handling servlet can access these attributes from the request object."
What confuses me the most is the fact that the javax.servlet package doesn�t have an error class.
Can somebody be kind enough to share with me a code snippet that does it?
Thanks,
Dan
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is pretty odd. There is a javax.servlet.ServletException as you undoubtedly know. It has constructors that let you attach another exception as a "rootCause" - but I don't know of anything like the code you show. Which book is this?
Bill
------------------
author of:
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi William,
The book name is 'Professional Java Server Programming J2EE Edition'. It's at the bottom of page 471.
I have another book which refers to these attributes -
It says -
"Two predefined request attributes
javax.servlet.error.status_code
javax.servlet.error.message"
It's from a book called 'Web Component Developer: Certification Fast Path' by David M. Geary, page 73.
Thanks,
Dan
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!