web.xml

项目的web.xml 文件


<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"   
	xmlns="http://java.sun.com/xml/ns/javaee" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
	http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

	<!-- 项目名称 -->
	<display-name>wlanjt</display-name>

	<!-- 指定配置文件的位置一般是dao,service -->
	<context-param>
		<param-name>contextConfigLocation</param-name><!--当param-value有多个值时,可以用空格或逗号隔开,或通配符。 -->
		<param-value>classpath:spring.xml,classpath:spring-jdbc.xml,classpath:spring-redis.xml</param-value>
	</context-param>

	<!-- listener在 context-param之后执行 -->
	<!-- 开启spring功能 -->
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<!-- 防止内存溢出监听器 -->
	<listener>
		<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
	</listener>
	<!--项目初始化 -->
	<listener>
		<listener-class>com.ffcs.wlan.listener.InitListener</listener-class>
	</listener>
	
	<!--filter在listener之后执行 -->
	<!-- 配置字符集过滤器 -->
	<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>
	</filter>
	<!-- 配置项目的编码mapping -->
	<filter-mapping>
		<filter-name>encodingFilter</filter-name>
		<url-pattern>/*.do</url-pattern>
	</filter-mapping>

	
	<!--servlet在filter之后执行 -->
	<!-- 配置spring mvc -->
	<servlet>
		<servlet-name>springMvc</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>classpath:spring-mvc.xml</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup><!-- servlet之间启动的优先顺序取决于此-->
	</servlet>

	<!-- 配置spring mvc mapping -->
	<servlet-mapping>
		<servlet-name>springMvc</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>
	<!-- 配置静态资源不经过spring mvc -->
	<servlet-mapping>
		<servlet-name>default</servlet-name>
		<url-pattern>*.css</url-pattern>
		<url-pattern>*.js</url-pattern>
		<url-pattern>*.json</url-pattern>
		<url-pattern>*.gif</url-pattern>
		<url-pattern>*.png</url-pattern>
		<url-pattern>*.jpg</url-pattern>
		<url-pattern>*.ico</url-pattern>
		<url-pattern>*.doc</url-pattern>
		<url-pattern>*.xls</url-pattern>
		<url-pattern>*.docx</url-pattern>
		<url-pattern>*.xlsx</url-pattern>
		<url-pattern>*.txt</url-pattern>
		<url-pattern>*.swf</url-pattern>
	</servlet-mapping>


	<!-- 配置session超时时间,单位分钟 -->
	<session-config>
		<session-timeout>15</session-timeout>
	</session-config>

	<!-- 设置欢迎页面 -->
	<welcome-file-list>
		<welcome-file>/link.jsp</welcome-file>
		<welcome-file>/index.jsp</welcome-file>
		<welcome-file>/init.jsp</welcome-file>
	</welcome-file-list>

	<!-- 找不到页错误转向 -->
	<error-page>
		<error-code>404</error-code>
		<location>/error/404.jsp</location>
	</error-page>
	<!-- 系统内部错误转向 -->
	<error-page>
		<error-code>500</error-code>
		<location>/error/500.jsp</location>
	</error-page>

</web-app>


你可能感兴趣的:(web.xml)