민서네집

How to specify the default error page in web.xml? 본문

WEB (HTML, CSS)

How to specify the default error page in web.xml?

브라이언7 2013. 10. 7. 17:58

web.xml 에서 다음과 같이 되어 있을때


<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">


... (생략)

<error-page>

<error-code>403</error-code>

<location>/WEB-INF/views/exception/common/no_authority.html</location>

</error-page>

<error-page>

<error-code>404</error-code>

<location>/WEB-INF/views/exception/page_not_found.html</location>

</error-page>

    <error-page>

        <location>/WEB-INF/views/exception/uncaught_exception.html</location>

    </error-page>

</web-app>


다음과 같은 이클립스 에러가 나면...


Description Resource Path Location Type

cvc-complex-type.2.4.a: Invalid content was found starting with element 'location'. One of '{"http://java.sun.com/xml/ns/javaee":error-code, "http://java.sun.com/xml/ns/javaee":exception-type}' is expected. web.xml /m2matm/src/webapp/WEB-INF line 123 XML Problem



< How to specify the default error page in web.xml? >


http://stackoverflow.com/questions/7066192/how-to-specify-the-default-error-page-in-web-xml


<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">


xsd 를 2.5 에서 3.0 으로 수정하면 validation 에서 에러가 안난다.


Comments