Hi,

doPost/doGet throw ServletException. I think the problem lies in that you are 
wrapping your exception but this does not translate to the exception actually 
being "of class" UserNotFoundException. You'd need to actually throw your own 
exception which could extend ServletException for example.

Cheers, Allistair.

> -----Original Message-----
> From: Carlos Bracho [mailto:[EMAIL PROTECTED]
> Sent: 04 July 2005 12:37
> To: tomcat-user@jakarta.apache.org
> Subject: Handling exceptions declaratively
> 
> 
> Hello everybody.
> 
> I am trying to handling exceptions declaratively, here is 
> part of my the 
> web.xml file:
> 
> 
> <error-page>
> 
> <exception-type>ladw.model.UserNotFoundException</exception-type>
> 
> <location>/error.jsp</location>
> 
> </error-page>
> 
> <error-page>
> 
> <exception-type>ladw.model.IlegalAccessException</exception-type>
> 
> <location>/error.jsp</location>
> 
> </error-page>
> 
> <error-page>
> 
> <exception-type>ladw.model.InvalidFileNameException</exception-type>
> 
> <location>/error.jsp</location>
> 
> </error-page> 
> 
> <servlet>
> 
> <servlet-name>testServlet</servlet-name>
> 
> <servlet-class>ladw.controller.testServlet</servlet-class>
> 
> </servlet>
> 
> <servlet-mapping>
> 
> <servlet-name>testServlet</servlet-name>
> 
> <url-pattern>/testServlet</url-pattern>
> 
> </servlet-mapping>
> 
> 
> I created a test servlet with the following code:
> 
> 
> /*
> 
> * testServlet.java
> 
> *
> 
> * Created on 3 de julio de 2005, 03:17 PM
> 
> */
> 
>  package ladw.controller;
> 
> 
> import java.io.*;
> 
> import java.net.*;
> 
> import ladw.model.UserNotFoundException;
> 
> import javax.servlet.*;
> 
> import javax.servlet.http.*;
> 
>  public class testServlet extends HttpServlet {
> 
> protected void doGet(HttpServletRequest request, HttpServletResponse 
> response)
> 
> throws ServletException, IOException {
> 
> throw new ServletException("Wrapped UserNotFoundException",new 
> UserNotFoundException()); 
> 
> }
> 
> protected void doPost(HttpServletRequest request, HttpServletResponse 
> response)
> 
> throws ServletException, IOException {
> 
>  }
>  
> }
> 
>  When I write this urL http://localhost:8080/LADW/testServlet 
> in my browser 
> I got the follow error:
> 
>  ladw.model.UserNotFoundException: User does not exist
> 
> ladw.controller.testServlet.doGet(testServlet.java:28)
> 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
> 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 
> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(
> MonitorFilter.java:362)
> 
>  What is wrong in the error pages declaration??? why the 
> error page does not 
> appear?
> 
> -- 
> ------------------------------------------------------------------
> Carlos J, Bracho M. 
> ------------------------------------------------------------------
> e-mail: [EMAIL PROTECTED]
> MSN: [EMAIL PROTECTED]
> +58 416 409 21 75 
> ------------------------------------------------------------------
> 


<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
-------------------------------------------------------
QAS Ltd.
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to