美文网首页
一个ssm框架的web.xml文件配置

一个ssm框架的web.xml文件配置

作者: writeanewworld | 来源:发表于2017-12-20 18:15 被阅读0次
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"      
xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee      
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>bookscity</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>

<!-- 配置SprongIoC容器加载的配置文件 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:config/applicationContext.xml</param-value>
</context-param>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:config/log4j.properties</param-value>
</context-param>
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>6000</param-value>
</context-param>

<!-- 用于初始化SpringIoC容器 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
 </listener>

<servlet>
<servlet-name>ds</servlet-name>
<!-- 核心控制器 -->
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

<init-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath:config/ds-servlet.xml</param-value>
</init-param>

<!-- 应用启动时,加载servlet -->
<load-on-startup>1</load-on-startup>
<multipart-config>
  <location>e:/upimgs</location>
  <max-file-size>5242880</max-file-size>
  <max-request-size>10485760</max-request-size>
  <file-size-threshold>0</file-size-threshold>
</multipart-config>
</servlet>
<servlet-mapping>
<!-- 约定优于配置,Spring MVC框架默认加载/WEB-INF/<servlet-name/>开头-servlet.xml作为配置文件载入web工程中-->
<servlet-name>ds</servlet-name>
<!-- 拦截配置 -->
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<!-- 过滤器配置 -->
<filter>
<filter-name>EncodingPictureFilter</filter-name>
<filter-class>com.bookscity.filter.EncodingPictureFilter</filter-class>
<init-param>
  <param-name>charset</param-name>
  <param-value>UTF-8</param-value> 
</init-param>
</filter>
<filter-mapping>
<filter-name>EncodingPictureFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
</web-app>

相关文章

网友评论

      本文标题:一个ssm框架的web.xml文件配置

      本文链接:https://www.haomeiwen.com/subject/xlcnwxtx.html