httpservlet----web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>secondWeb</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>context</param-name>
<param-value>这是context的值</param-value>
</context-param>
<!-- 在web.xml文件中设置session存在的时间,当前设置为40分钟。设置session存在的时间包括三种方法
1、在服务器conf文件夹的web文件中修改session-config里面的时间,单位是分钟
2、在当前文件中设置时间,单位是分钟
3、在Java文件中通过setMaxInactiveInterval(time)方法设置时间,单位是秒,负数表示不过期
这三者执行顺序按照就近原则,即优先级3>2>1-->
<!-- session的销毁包括三种
1、设置的会话时间已经超时
2、在session对象上直接调用invalidate()方法
3、服务器重置 -->
<session-config>
<session-timeout>40</session-timeout>
</session-config>
<servlet>
<servlet-name>first</servlet-name>
<servlet-class>secondWeb.one</servlet-class>
</servlet>
<servlet>
<servlet-name>second</servlet-name>
<servlet-class>secondWeb.second</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>first</servlet-name>
<url-pattern>/first</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>second</servlet-name>
<url-pattern>/second</url-pattern>
</servlet-mapping>
</web-app>

原文地址:https://www.cnblogs.com/quanby/p/5612387.html