Web.xml Learning (7) _mime-mapping, Welcome-file-list, Error-page

Source: Internet
Author: User
Tags error code mail resource

10.mime-mapping:mime-mapping contains two child elements extension and Mime-type. Defines an extension and a MIME type to do the mapping.

MIME (Multipurpose Internet Mail Extensions) Multipurpose Internet Mail Extension type is the type of way in which files with an extension are set to open in one application.

When the extension file is accessed, the browser automatically opens with the specified application. Used to specify some client-defined file names and how some media files are opened

After the browser receives the file, it goes to the plugin system to find out which plug-ins can recognize the files that are received by the read.

If the browser does not know which plug-in system to call, it may tell the user that a plugin is missing, or that an existing plug-in may be selected directly to attempt to read the received file, which could cause the system to crash.

The lack of a MIME identity in the transmitted information can be difficult to estimate because some computer systems may not fail, but some computers may crash as a result.

<!--mime-mapping contains two child elements extension and Mime-type. Defines an extension and a MIME type to do the mapping.  -->   
    <mime-mapping>   
        <!--extended name  -->   
        <extension>htm</extension>   
        < !--MIME format  -->   
        <mime-type>text/html</mime-type>   
    </mime-mapping>

11.welcom-file-list: Instructs the server to use which file when it receives a URL that references a directory name instead of a filename.

<welcome-file-list>

Welcome-file-list contains a child element welcome-file. Used to define the first list.

<welcome-file> to specify the first page file name </welcome-flie>

Welcome-file is used to specify the first page file name. We can use <welcome-file> to specify a few home pages, and the server will be in accordance with the order to find the home page.

Example:

<welcome-file-list>  
  <welcome-file>index.jsp</welcome-file>  
  <welcome-file> Index.htm</welcome-file>  
</welcome-file-list>

12.error-page: Enables the page to be displayed when a particular HTTP status code is returned, or when a particular type of exception is thrown.

The Error-page element contains three child elements error-code,exception-type and location. Corresponds to the type of error code or exception (exception)

To the Web platform resource path.

<error-code> Error code </error-code>

HTTP Error Code, for example: 404

<exception-type>Exception</exception-type>

A Java exception type with a full name

<location>/Path </location>

Related resource paths within a web platform

</error-page>

Example:

<error-page>  
   <error-code>404</error-code>  
   <location>/error404.jsp</location >  
</error-page>  
<error-page>  
   <exception-type>java.lang.exception</ exception-type>  
   <location>/except.jsp</location>  
</error-page>

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/aspx/

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.