Interview Questions

How to configure error page in web.xml?

Make the following configuration in web.xml to handle http errors/ exceptions in web applications.

<error-page>
      <error-code>500</error-code>
      <location>/error.jsp</location>
</error-page>

<error-page>
      <error-code>400</error-code>
      <location>/error.jsp</location>
</error-page>

<error-page>
      <exception-type>java.lang.NullPointerException</exception-type>
      <location>/error.jsp</location>
</error-page>