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

Asked

Viewed 39 times

0

I need to trigger an error page in case of exceptions. I put that code on 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>

But I got this comeback:

XML Parsing Error: no root element found

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

1 answer

1

I resolved so

<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 anyone needs an answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.