I need help with error pages. I would like to use some of the techniques that Jason Hunter suggests for Error Handling in Java Servlet Programming, 2nd Edition, Chapter 5, especially error pages. Unfortunately, Hunter gives only some of the information you need to do this so I'm hoping someone who reads this list will have figured out the rest of what is required.
Many of the errors my servlet(s) will generate will be for status_code 500 (Internal Server Error) so I would like to create my own error page for code 500. This leads me to my first question: 1. Where can I find more information on the syntax of the <location> tag in the web.xml file? Specifically, if I imitate Hunter's code and set my location to /500.html, where does the actual 500.html file need to be? I am using JBuilder6 and Tomcat 4.0. Every place I've tried putting my 500.html file leads to "document not found" error. I really like the technique described on p. 150 in the sample servlet called ErrorDisplay. 2. If I wrote my own version of ErrorDisplay, exactly where would I need to put the code and what path would I need in the <location> tag of web.xml? 3. How would I invoke ErrorDisplay? I'm not clear on whether I can call it directly from my servlet when I encounter an error or will ErrorDisplay be invoked "automagically" via the <error-code> and <location> tags in web.xml? If the latter is true, can someone explain what exact event triggers the invoking of the error page so that I can make sure my servlet does exactly the right thing to trigger the error page? 4. How would I revise ErrorDisplay to pass the error message of my choice to ErrorDisplay? I don't want the message to be a generic "Internal Server Error", I want it to be specific about what happened. I have already written code that produces a variety of error messages so I just need to know how to pass a specific error message to a revised ErrorDisplay. 5. Does anyone have a short example that does all or most of what I've described in this note? If yes, I'd love to see it. Henry ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
