码迷,mamicode.com
首页 > Web开发 > 详细

web.xml

时间:2016-10-22 23:42:29      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:org   timeout   att   code   servlets   pow   编译   video   false   

在Tomcat/conf下有一个web.xml文件,当Tomcat中所有web应用实例化时都会读取该配置文件,然后读取每个web应用自己的配置文件(/WEB-INF/web.xml)。

conf/web.xml作出以下配置:

//处理未映射到其他servlet的请求
    <servlet>
        <servlet-name>default</servlet-name>
        <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
        <init-param>
            <param-name>listings</param-name>
            <param-value>false</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
//jsp页面编译和执行servlet
    <servlet>
        <servlet-name>jsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
            <param-name>fork</param-name>
            <param-value>false</param-value>
        </init-param>
        <init-param>
            <param-name>xpoweredBy</param-name>
            <param-value>false</param-value>
        </init-param>
        <load-on-startup>3</load-on-startup>
    </servlet>
//映射关系
    <!-- The mapping for the default servlet -->
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <!-- The mappings for the JSP servlet -->
    <servlet-mapping>
        <servlet-name>jsp</servlet-name>
        <url-pattern>*.jsp</url-pattern>
        <url-pattern>*.jspx</url-pattern>
    </servlet-mapping>

//会话设置
    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
//MIME类型映射
    <mime-mapping>
        <extension>123</extension>
        <mime-type>application/vnd.lotus-1-2-3</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>3dml</extension>
        <mime-type>text/vnd.in3d.3dml</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>3ds</extension>
        <mime-type>image/x-3ds</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>3g2</extension>
        <mime-type>video/3gpp2</mime-type>
    </mime-mapping>
...
...
...

 

web.xml

标签:org   timeout   att   code   servlets   pow   编译   video   false   

原文地址:http://www.cnblogs.com/wuchaodzxx/p/5988416.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!