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>

时间: 2024-08-11 03:28:57

httpservlet----web.xml的相关文章

web.xml的配置中&lt;context-param&gt;配置作用

<context-param>的作用: web.xml的配置中<context-param>配置作用1. 启动一个WEB项目的时候,容器(如:Tomcat)会去读它的配置文件web.xml.读两个节点: <listener></listener> 和 <context-param></context-param> 2.紧接着,容器创建一个ServletContext(上下文),这个WEB项目所有部分都将共享这个上下文. 3.容器将&l

web.xml中Filter,Listener,Servlet的区别

一.Servlet Servlet是基本的服务端程序,他来自接口Servlet,接口中有方法service.而Servlet的一个重要实现类,则是tomcat服务器的核心,那就是HttpServlet HttpServlet有方法: public abstract class HttpServlet extends GenericServlet { private static final String METHOD_DELETE = "DELETE"; private static

web.xml详解

web.xml的作用 web.xml,一个Tomcat工程中最重要的配置文件.web.xml没有其实也可以----只要你确定你的项目里面不需要任何过滤器.监听器.Servlet等等.我试了一下,没有web.xml对那些已经编译成Servlet的jsp页面来说,是不影响正常显示的,但是那些没有编译成Servlet的jsp页面,访问的时候就会报500的错误了.下面逐一看一下web.xml里常用标签的作用. welcome-file-list 这个标签是用来配置首页用的: <welcome-file-

eclipes创建一个web项目web.xml不能自动更新的原因(web.xml和@WebServlet的作用)

在eclipse中创建一个Web项目的时候,虽然有web.xml生成,但是再添加Servlet类文件的时候总是看不见web.xml的更新,所以异常的郁闷!上网查了查,原来我们在创建Web项目的时候,会弹出一个对话框,“Dynamic web module version”这个选项默认成了3.0,按照老规范,应该是在eclipse的WebContent \ WEB-INF \ 目录下创建web.xml的.而新规范是可以不用web.xml的,如tomcat 7.0就支持新规范,这样相关的servle

jeesite部署到Tomcat后,无法访问,cannot be resolved in either web.xml or the jar files deployed with this application

HTTP Status 500 - /WEB-INF/views/modules/sys/sysLogin.jsp (line: 3, column: 0) The absolute uri: http://www.springframework.org/tags/form cannot be resolved in either web.xml or the jar files deployed with this application type Exception report messa

Spring MVC的web.xml配置详解(转)

出处http://blog.csdn.net/u010796790 1.spring 框架解决字符串编码问题:过滤器 CharacterEncodingFilter(filter-name) 2.在web.xml配置监听器ContextLoaderListener(listener-class) ContextLoaderListener的作用就是启动Web容器时,自动装配ApplicationContext的配置信息.因为它实现了ServletContextListener这个接口,在web.

Servlet 配置文件web.xml实验

我们的servlet为 import java.io.IOException; import java.io.PrintWriter; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ServletDemo1 extends HttpServlet{ pub

[转载] web.xml之&lt;context-param&gt;与&lt;init-param&gt;的区别与作用

原文地址: http://www.cnblogs.com/hzj-/articles/1689836.html <context-param>的作用:web.xml的配置中<context-param>配置作用1. 启动一个WEB项目的时候,容器(如:Tomcat)会去读它的配置文件web.xml.读两个节点: <listener></listener> 和 <context-param></context-param> 2.紧接着,

发布一个简单的网站,网页内容为100首《悯农》(练习STS的使用、web.xml的配置、Tomcat的发布流程)

开发环境为Spring Tool Suite: 一.首先配置STS.ini,配置文件如下: -startupplugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar--launcher.libraryplugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.400.v20160518-1444-productorg.springsource.sts.ide--lau

获取web.xml中的context-param和init-param定义的值

web.xml里面可以定义两种参数:<context-param> 和</init-param> (1)application范围内的参数,存放在servletcontext中,在web.xml中配置如下: 1 <context-param> 2 <param-name>context/param</param-name> 3 <param-value>avalible during application</param-val