ssm开发关于web.xml配置
Posted 羽哲
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ssm开发关于web.xml配置相关的知识,希望对你有一定的参考价值。
1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app version="3.0" 3 xmlns="http://java.sun.com/xml/ns/javaee" 4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 5 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 6 http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> 7 <display-name>Archetype Created Web Application</display-name> 8 <welcome-file-list> 9 <welcome-file>/WEB-INF/pages/index.jsp</welcome-file> 10 </welcome-file-list> 11 <!-- 配置监听spring--> 12 <listener> 13 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 14 </listener> 15 <!-- 指定spring bean 的配置文件所在目录 --> 16 <context-param> 17 <param-name>contextConfigLocation</param-name> 18 <param-value>classpath:applicationContext-*.xml</param-value> 19 </context-param> 20 21 <!-- 配置spring字符编码为utf-8 --> 22 <filter> 23 <filter-name>encodingFilter</filter-name> 24 <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 25 <init-param> 26 <param-name>encoding</param-name> 27 <param-value>UTF-8</param-value> 28 </init-param> 29 <init-param> 30 <param-name>forceEncoding</param-name> 31 <param-value>true</param-value> 32 </init-param> 33 </filter> 34 <filter-mapping> 35 <filter-name>encodingFilter</filter-name> 36 <url-pattern>/*</url-pattern> 37 </filter-mapping> 38 39 <!-- springMVC的配置 --> 40 <servlet> 41 <servlet-name>spring</servlet-name> 42 <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 43 <init-param> 44 <param-name>contextConfigLocation</param-name> 45 <param-value>classpath:spring-servlet.xml</param-value> 46 </init-param> 47 <load-on-startup>1</load-on-startup> 48 </servlet> 49 <servlet-mapping> 50 <servlet-name>spring</servlet-name> 51 <url-pattern>/</url-pattern> 52 </servlet-mapping> 53 54 55 56 <!-- log4j配置 --> 57 <context-param> 58 <param-name>log4jConfigLocation</param-name> 59 <param-value>classpath:log4j.properties</param-value> 60 </context-param> 61 <context-param> 62 <param-name>webAppRootKey</param-name> 63 <param-value>SLSaleSystem.root</param-value> 64 </context-param> 65 <!-- spring加载log4j的监听 --> 66 <listener> 67 <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> 68 </listener> 69 </web-app>
以上是关于ssm开发关于web.xml配置的主要内容,如果未能解决你的问题,请参考以下文章
ssm整合shiro时web。xml中配置filter,tomcat报错