tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raphael <rci...@alphacent.com>
Subject Re: How to add a throw exception to a servlet
Date Tue, 07 May 2002 08:00:53 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm late with this reply but thanks!

Le Vendredi 03 Mai 2002 12:26, Ion Larranaga a écrit :
> Hi,
>
> 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
> {
> 	try
> 	{
> 		/*
> 		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,
>
>    Ion
>
> >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 ?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE814m1h2ITK4xBkFERAstoAJ9ZvhkOi5ndsMuzBDssBIPGl48lNACfRxXg
qDjJ8zUzIyi28j+iMMJBsJs=
=K4I9
-----END PGP SIGNATURE-----


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message