You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Терехов Кирилл Александрович <te...@hitmp3.ru> on 2006/02/04 16:15:37 UTC
Catching runtime exception
I don't understand, how to catch exceptions in
javax.servlet.http.HttpServlet.doGet.
This code works fine:
public void doGet |(HttpServletRequest req, HttpServletResponse resp)
{
...
...
bla-bla-bla
throw new ServletException ("my exception");
}
I redirect exceptions to my error servlet page by web.xml:
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error</location>
</error-page>
but this code is not working in doGet (...). I don't get control to my
error servlet:
try
{
java.nio.charset.Charset charset =
java.nio.charset.Charset.forName ("unexisting charset");
}
catch (Exception e)
{
throw new ServletException ("Perkele: Charset error", e);
}
I have exception list in tomcat container log file:
java.nio.charset.UnsupportedCharsetException: unexisting exception
....
Exception Processing ErrorPage[exceptionType=java.lang.Exception,
location=/error]
java.lang.IllegalStateException
Question is, how can i control all exceptions in my servlet code?
Thanks!
|
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org