SpringMVC的web.xml的配置。
来源:互联网 发布:大数据列存储 编辑:程序博客网 时间:2024/06/07 10:36
大致配置如下:
<?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" xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp" 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></display-name>
<!-- spring框架必须定义ContextLoaderListener,在启动Web容器时,自动装配Spring applicationContext.xml的配置信息 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<!-- 指定Spring上下文配置文件 -->
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<!-- 指定SpringMVC配置文件 -->
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-mvc.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<!-- 指定请求的后缀,可以随意写,这里用.html作为请求后缀 -->
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
或者:
<?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" xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp" 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></display-name>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext.xml</param-value>
</context-param>
<context-param>
<param-name>spring.profiles.active</param-name>
<param-value>production</param-value>
</context-param>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-mvc.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<!-- 编码格式为UTF-8 -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>false</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<session-config>
<session-timeout>1440</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<error-page>
<error-code>403</error-code>
<location>/WEB-INF/page/error/403.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/page/error/404.jsp</location>
</error-page>
<error-page>
<error-code>400</error-code>
<location>/WEB-INF/page/error/404.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/WEB-INF/page/error/500.jsp</location>
</error-page>
</web-app>
- SpringMVC的web.xml配置
- SpringMVC的web.xml的配置。
- SpringMVC的web.xml的配置
- springmvc中配置web.xml的问题
- springmvc+spring的web.xml配置
- springMvc在web.xml文件的配置
- Springmvc中web.xml的配置详解
- springmvc中的web.xml的配置讲解
- 在web.xml中配置SpringMVC的启动配置项
- SpringMVC配置web.xml文件详解(列举常用的配置)
- SpringMVC配置web.xml文件详解(列举常用的配置)
- SpringMVC配置web.xml文件详解(列举常用的配置)
- SpringMVC配置web.xml文件详解(列举常用的配置)
- springmvc/mybaits的web.xml配置:Could not open ServletContext resource [/WEB-INF/springmvc-servlet.xml]
- springMVC的配置文件名在web.xml中如何定义
- springmvc web.xml 配置默认的controller访问问题
- springMVC中web.xml配置/和/*的区别
- springMVC中简单的web.xml配置信息
- poll方法(select多路监控原理与实现)
- CocoaPods安装过程
- Nm3/h是什么意思?和m3/h是什么换算关系?
- C#套接字Socket编程之最简单通信
- c++ winhttp通过https双向认证
- SpringMVC的web.xml的配置。
- 序
- Lowest Common Ancestor of a Binary Tree 二叉树中的最小公共父节点
- Android之AlarmManager学习
- 从最大似然到EM算法浅解
- 内部类,外部类成员的相互访问 及内部类对象的创建
- PL/SQL Developer执行.sql文件的几种方法
- Oracle 游标使用全解
- 编程之美: 求二叉树中节点的最大距离