The service() method of a
servlet can only throw ServletException or IOException (or there subclasses). So all other exceptions have to be caught. Servlet generated by
Tomcat for your
JSP is no exception. It puts all the code in a try/catch block as shown below: