How to setup error page web xml?

by Guest3547  |  12 years, 2 month(s) ago

0 LIKES UnLike

I am new to xml, someone please tell me how to setup error page in web xml.

 Tags: Error, page, setup, Web, XML



  1. Guest7542

    Here are few methods for creating XML error page:

    1. web.xml

    The standard web application configuration file is in <webapp>/WEB-INF/web.xml could be utilize to map errors to specific URLs with the <error-page> element. This element makes a mapping between the error-code or exception type to the location of a resource in the web application.

    • error-code - integrate value

    • exception-type – It is fully qualified class name of a Java Exception type

    • location - location of the resource in web application relative to the root of the web application. Value should start with "/".

    example of Error code:





    example of Exception:





    2. context file configuration.

    Context files are nomrally found in <jetty.home>/contexts/?.xml (see ContextDeployer for further detail). Context files can be utilized for configuring the default error handler that is required for a context with more flexibility , available with web.xml,

    specifically with the support of error code ranges:

    <?xml version="1.0"  encoding="ISO-8859-1"?>

    <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "">

    <Configure class="org.mortbay.jetty.webapp.WebAppContext">

    <Set name="contextPath">/test</Set>

    <Set name="war">

    <SystemProperty name="jetty.home" default="."/>/webapps/test


    <!-- by Code -->

    <Get name="errorHandler">

    <Call name="addErrorPage">

    <Arg type="int">404</Arg>

    <Arg type="String">/jspsnoop/ERROR/404</Arg>



    <!-- by Exception -->

    <Get name="errorHandler">

    <Call name="addErrorPage">


    <Call class="java.lang.Class" name="forName">

    <Arg type="String"></Arg>



    <Arg type="String">/jspsnoop/IOException</Arg>



    <!-- by Code Range -->

    <Get name="errorHandler">

    <Call name="addErrorPage">

    <Arg type="int">500</Arg>

    <Arg type="int">599</Arg>

    <Arg type="String">/dump/errorCodeRangeMapping</Arg>





Sign In or Sign Up now to answser this question!

Question Stats

Latest activity: 12 years, 6 month(s) ago.
This question has 1 answers.


Share your knowledge and help people by answering questions.