• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with deployment-descriptor's error-page mapping

 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Robert
Were you using HttpServletResponse.sendError() to create the error code?
 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic