您的位置:首页 > 运维架构 > Tomcat

tomcat中的web.xml和web项目中的web.xml

2016-01-25 22:32 441 查看
tomcat下conf下的web.xml里面的一部分

<!-- ==================== Default Welcome File List ===================== -->

<!-- When a request URI refers to a directory, the default servlet looks -->

<!-- for a "welcome file" within that directory and, if present, to the -->

<!-- corresponding resource URI for display. -->

<!-- If no welcome files are present, the default servlet either serves a -->

<!-- directory listing (see default servlet configuration on how to -->

<!-- customize) or returns a 404 status, depending on the value of the -->

<!-- listings setting. -->

<!-- -->

<!-- If you define welcome files in your own application's web.xml -->

<!-- deployment descriptor, that list *replaces* the list configured -->

<!-- here, so be sure to include any of the default values that you wish -->

<!-- to use within your application. -->

<welcome-file-list>

<welcome-file>index.html</welcome-file>

<welcome-file>index.htm</welcome-file>

<welcome-file>index.jsp</welcome-file>

</welcome-file-list>

</web-app>

<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>true</param-value>

</init-param>

<load-on-startup>1</load-on-startup>

</servlet>

其中,load-on-startup表示启动时加载,其中的 <init-param>

<param-name>listings</param-name>

<param-value>true</param-value>

</init-param>

true表示将向客户端一一展示WebRoot下面除了META-INF和WEB-INF的所有文件。false表示返回404错误页面。

JavaEE是一种规范,有很多实现,servlet只是其中一种。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: