spring框架的基本配置信息 web.xml 配置
使用spring,spring-mvc,MyBatis ssm整合框架开发,一个基本的web.xml配置。
最下面代码可以直接粘贴到web项目中WEB-INF下的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_2_5.xsd" id="WebApp_ID" version="2.5">
<!-- 默认首页 -->
<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>
<!-- 配置spring-MVC核心控制器 -->
<servlet>
<!-- 自定义个控制器名 -->
<servlet-name>spring</servlet-name>
<!-- 配置spring-MVC所在的包,即完全限定名 -->
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-- 如果spring-servlet.xml文件没有放在WEB-INF,放在src目录下,需配置此项 -->
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/spring-servlet.xml</param-value>
</init-param>
<!-- 设置被加载的顺序 (优先级)-->
<load-on-startup>0</load-on-startup>
</servlet>
<!-- 配置启用控制器的路径(‘/’)标识所有有路径都会转到控制器中去找方法 -->
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- 配过滤器 -->
<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>true</param-value>
</init-param>
</filter>
<!-- 配置过滤器路径 -->
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 配置spring框架 -->
<!-- 配置spring框架监听 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 配置加载spring配置文件applicationContent.xml -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
</web-app>
- 使用ssm框架在web.xml中的基本配置信息
- web.xml配置错误错误页面,及输出错误信息
- JFinal 项目web.xml 基本配置解读 项目
- javaWeb工程中web.xml的基本配置
- Servlet不同版本配置web.xml头信息
- web.xml基本配置
- servlet中用注解的方式读取web.xml中的配置信息
- web.xml+spring mvc基本配置
- web.xml配置中信息的一些含义
- 项目实战:javaWeb工程中web.xml的基本配置解析
- JavaWeb从入门到放弃(10)-web.xml中信息的配置-持续更新
- springjdbc中applicationContext.xml和web.xml配置信息
- JavaWeb工程中web.xml基本配置
- ssm的web.xml 配置信息
- web.xml自定义配置信息
- web.xml文件的作用及基本配置
- web.xml文件的作用及基本配置
- jsp web.xml文件的作用及基本配置
- jsp web.xml文件的作用及基本配置
- JavaWeb工程中web.xml基本配置