How to trigger page in case of error in web.xml JAVA

0

I need to trigger an error page in case of exceptions. I put this code in web.xml :

<error-page>
    <exception-type>java.sql.SQLException</exception-type>

    <location>/Casa da Borracha/erro.xhtml</location>
</error-page>

<error-page>
    <exception-type>java.io.IOException</exception-type >
    <location>/Casa da Borracha/erro.xhtml</location>
</error-page>

<error-page>
    <exception-type>javax.servlet.ServletException</exception-type>

    <location>/Casa da Borracha/erro.xhtml</location>
</error-page>

I have this return:

  

XML Parsing Error: no root element found

Remembering that my error page is at the root of the project.

    
asked by anonymous 10.08.2018 / 19:41

1 answer

1

I solved it as well

<error-page>
    <exception-type>java.sql.SQLException</exception-type>

    <location>/error.xhtml</location>
</error-page>

<error-page>
    <exception-type>java.io.IOException</exception-type >
    <location>/error.xhtml</location>
</error-page>

<error-page>
    <exception-type>javax.servlet.ServletException</exception-type>

    <location>/error.xhtml</location>
</error-page>

If someone needs this, then the answer is there.

    
10.08.2018 / 20:08