SSM商城系统开发笔记-配置01-web.xml

先占坑 慢慢填,

商城系统使用主体框架:Spring + Spring MVC + Mybatis

其他框架:

日志: slf4j + logback

<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<!--xml 3.1-->
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
 <!-- 使用3.1版本 注意在pom.xml中更改依赖 -->
<!-- servlet 默认静态资源 过滤器设置 -->
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
<!--******略去余下部分******--> <!--
配置SpringMVC 需要配置的文件
spring-*.xml
spring-dao.xml spring-service.xml spring-web.xml
Mybites spring springMvc
-->
<servlet>
<servlet-name>spring-mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/spring-*.xml</param-value>
</init-param>
</servlet> <servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<!-- '/' 默认匹配所有请求-->
<url-pattern>/</url-pattern>
</servlet-mapping> <!-- Spring 字符集过滤器 -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<!--字符集设置为 utf-8-->
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<!--
设置应用场景
flase只针对request做字符转换
true对request、response都做字符转换
-->
<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> <welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list> </web-app>
上一篇:NBUT1457 Sona 莫队算法


下一篇:Chapter 2 User Authentication, Authorization, and Security(3):保server避免暴力袭击