Instead of showing error page for individual action performed in Servlet,JSP,It is always recommended to configure those error page in web.xml
<web-app>
<servlet>
<!-- some servlet cofiguration -->
</servlet>
<servlet-mapping>
<!-- some servlet mappings-->
</servlet-mapping>
<welcome-file-list>
<!-- Welcomefile list configurations-->
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/pagenotfound.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error.jsp</location>
</error-page>
</web-app>
<web-app>
<servlet>
<!-- some servlet cofiguration -->
</servlet>
<servlet-mapping>
<!-- some servlet mappings-->
</servlet-mapping>
<welcome-file-list>
<!-- Welcomefile list configurations-->
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/pagenotfound.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error.jsp</location>
</error-page>
</web-app>
No comments:
Post a Comment