The moose likes Servlets and the fly likes Not recognizing the error-page tag in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Not recognizing the error-page tag in web.xml" Watch "Not recognizing the error-page tag in web.xml" New topic

Not recognizing the error-page tag in web.xml

Sudhir V
Ranch Hand

Joined: Dec 25, 2002
Posts: 143
I have the following code in the web.xml file
and the following is the error_handler servlet
class error_handler extends HttpServlet
public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException
ServletContext sud = this.getServletContext ();
res = (HttpServletResponse)sud.getAttribute ("resobj");
SQLException ce = (SQLException)sud.getAttribute ("excp");
String msg = ce.getMessage ()+" in error-handler";
res.sendError (HttpServletResponse.SC_NO_CONTENT ,msg);

the main program throws an SQLExcpetion but the container is not invoking the error_handler servlet. any suggestions!!!

Sudhir V<br />(SCJP 1.2, SCWCD, OCA, SCBCD)
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5376
check the position of <error-page> tag in web.xml.
restart the server.

"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
if your code throws an exception (r u sure it does? ) the problem is probably in your error-page tag in the web.xml. read this :
there is also a chance , in case you use ie, your browser uses its own error messages. to stop this uncheck "use friendly error messages" in your ie preferences.

Asher Tarnopolski
Have you checked out Aspose?
subject: Not recognizing the error-page tag in web.xml
It's not a secret anymore!