How to make a ErrorController, like the ErrorController in the Zend Framework for PHP, with servlets in java?
Now I have this
<servlet>
<display-name>ErrorController</display-name>
<servlet-name>ErrorController</servlet-name>
<servlet-class>project.controller.ErrorController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ErrorController</servlet-name>
<url-pattern>/error</url-pattern>
</servlet-mapping>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error</location>
</error-page>
Is it possible to have something similar with servlets?
I am not sure about Zend, but in Java/Servlet you can define error pages for specific error codes (definition goes into WEB-INF/web.xml):
The location is not necessarily required to be jsp and can then be chewed by a filter which would take user to a relevant controller.