wood burning stoves 2.0*
The moose likes Servlets and the fly likes Problem with deployment-descriptor's error-page mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem with deployment-descriptor Watch "Problem with deployment-descriptor New topic
Author

Problem with deployment-descriptor's error-page mapping

Robert Paris
Ranch Hand

Joined: Jul 28, 2002
Posts: 585
I've set the error page as such (in web.xml):

but that error code gets thrown and it never goes to my error page. however, if I set "errorPage=error.html" in the page directive of a JSP page, it goes there on an error, but not if I use the error-page XML tags. why isn't the web.xml mapping it up?
Mark Howard
Ranch Hand

Joined: Feb 14, 2001
Posts: 285
Robert
Just a wild swing here - what if you swapped the <error-code> and <location> tags around in the deployment descriptor? XML is sometimes fussy about the order of its definitions.
Robert Paris
Ranch Hand

Joined: Jul 28, 2002
Posts: 585
hey mark,
thanks for the reply. unfortunately it didn't work. What's interesting is that if i switch the error-code for the exception-type tag, then it works. But I wanted to be able to send specific codes to diff pages. I guess I'll have to throw different errors instead.
Mark Howard
Ranch Hand

Joined: Feb 14, 2001
Posts: 285
Robert
Were you using HttpServletResponse.sendError() to create the error code?
Robert Paris
Ranch Hand

Joined: Jul 28, 2002
Posts: 585
no, should I have? I just did "throw new..."
So it will go to the correct error-code page only if you use sendError? Hmmm, makes sense. Thanks!
Engin Okucu
Ranch Hand

Joined: Feb 09, 2002
Posts: 174
Hi Robert,
for more information take a look at here :
http://www.wrox.com/books/sample-chapters/SampleChapter_1861007701.pdf
<!ELEMENT error-page ((error-code|exception-type),location)>
 
 
subject: Problem with deployment-descriptor's error-page mapping
 
Similar Threads
web.xml and error-page
<error-page>
<error-page>
<error-code>404</error-code> happens only once.
HELP! Problems with Buffer/Response Committed