Web. XML configuration file

Source: Internet
Author: User
Tags event listener

Filter
<!--the filter element relates a name to a class that implements the Javax.servlet.Filter interface -<Filter>    <!--Declaration Description Information -     <Description></Description>    <!--used to define the name of the Web App -     <Display-name></Display-name>    <!--the path to the class that specifies the current filter -     <Filter-class></Filter-class>    <!--used to take a name for the current filter so that it is used in subsequent mappings -     <Filter-name></Filter-name>    <!--Specify large icons and small icons for your app -     <icon></icon>    <!--used to specify some initialization parameters for the current filter -     <Init-param></Init-param></Filter><filter-mapping><!--There are four possible values for this element: request (default), Forward,include and error, which can include any number of <dispatcher> in a <filter-mapping> element;
So that filter will act on the request directly from the client, through forward request, through the include request and through the <error-page> Request.
If no < Dispatcher > element is specified, the default value is request - <Dispatcher></Dispatcher> <!--used to specify the filter name defined above - <Filter-name></Filter-name> <!--used to specify the servlet name defined above - <Servlet-name></Servlet-name> <!--describes the pattern used to resolve URLs - <Url-pattern></Url-pattern></filter-mapping>
Servlet
<!--when you set initialization parameters or custom URLs to a servlet or JSP page, you must first name the servlet or JSP Page. The servlet element is used to accomplish this task. -<servlet>    <!--Declaration Description Information -     <Description></Description>    <!--used to define the name of the Web App -     <Display-name></Display-name>    <!--Specify large icons and small icons for your app -     <icon></icon>    <!--used to specify some initialization parameters for the servlet -     <Init-param></Init-param>    <!--used to specify a JSP page to initialize the servlet -     <Jsp-file></Jsp-file>    <!--used to specify the priority at which the app is loaded at startup -     <Load-on-startup></Load-on-startup>    <!--This element specifies the run identity that the Web application needs to run -     <Run-as></Run-as><!--This element links the security role name defined by <security-role> to an alternate role name that is hardcoded with the servlet logic.
With this additional extraction layer, You can configure the servlet at deployment time without changing the servlet code - <Security-role-ref></Security-role-ref> <!--the path that specifies the class that the current servlet corresponds to - <Servlet-class></Servlet-class> <!--used to take a name for the current servlet so that it is used in subsequent mappings - <Servlet-name></Servlet-name></servlet><!--the server typically provides a default url:http://localhost/webappprefix/servlet/servletname for the Servlet.
however, This URL is often changed so that the servlet can access the initialization parameters or make it easier to handle relative urls. When changing the default url, use the servlet-mapping element -<servlet-mapping> <!--used to specify the name of the servlet configured above - <Servlet-name></Servlet-name><!--describes the pattern used to resolve URLs - <Url-pattern></Url-pattern></servlet-mapping>
Context-param
<!--the element declares an application-scoped initialization parameter -<Context-param>    <!--Declaration Description Information -     <Description></Description>    <!--the name used to specify the context parameter -     <Param-name></Param-name>    <!--value to specify the context parameter -     <Param-value></Param-value> </Context-param>
Listener
<!--event listeners are notified when a session or servlet environment is established, modified, and Deleted. The listener element indicates that the event listener class -<Listener>    <!--Declaration Description Information -     <Description></Description>    <!--used to define the name of the Web App -     <Display-name></Display-name>    <!--Specify large icons and small icons for your app -     <icon></icon>    <!--class for specifying listeners (full Path) -     <Listener-class></Listener-class></Listener>
Error-page
<!--When a specific HTTP status code is returned, or when a particular type of exception is thrown, the page that will be displayed is prepared -<Error-page>    <!--error code for specifying HTTP -     <Error-code></Error-code>    <!--used to specify exceptions in the program (the full path of the Exception) -     <Exception-type></Exception-type>    <!--to Specify the page to jump to when a program error occurs -     < location></ location></Error-page>
Description
<!-- declaring a Web App's descriptive information  - < Description ></ Description >
Display-name
<!-- defines the name of the Web App  - < Display-name ></ Display-name >
Welcome-file-list
<!-- indicates which file the server uses when it receives a URL that references a directory name instead of a file name  - < welcome-file-list >    <!-- the path used to specify the Welcome page  -     < Welcome-file ></ Welcome-file > </ welcome-file-list >

Web. XML configuration file

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.