tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ion Larranaga <>
Subject RE: How to add a throw exception to a servlet
Date Fri, 03 May 2002 10:26:52 GMT

There's no way to add new exception types to the doPost method. However,
you could do something like:

public void doPost(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException
		your code
	catch (SQLException exc)
		throw new ServletException(exc);

This way, the real exception goes nested within a ServletException and you
don't have to change the method signature.

Hope it helps,


>But I want the exception to be caught in the error.jsp page, not do a try
>{...} catch{...} inside the doPost body.
>I don't know if I explained it correctly but is there a simple solution to
>this problem ?

To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message