1 <?xml version="1.0" encoding="UTF-8"?> 2 3 <!-- Bean命名空间 Context命名空间 p命名空间 --> 4 <beans xmlns="http://www.springframework.org/schema/beans" 5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 6 xmlns:context="http://www.springframework.org/schema/context" 7 xmlns:p="http://www.springframework.org/schema/p" 8 xsi:schemaLocation="http://www.springframework.org/schema/beans 9 http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 10 http://www.springframework.org/schema/context 11 http://www.springframework.org/schema/context/spring-context-3.2.xsd"> 12 13 <!-- 视图解析器 --> 14 <bean id="viewResolver" 15 class="org.springframework.web.servlet.view.InternalResourceViewResolver" 16 p:viewClass="org.springframework.web.servlet.view.JstlView" 17 p:prefix="/WEB-INF/pages/" 18 p:suffix=".jsp"/> 19 20 </beans>
1 <?xml version="1.0" encoding="UTF-8"?> 2 <!-- Bean命名空间 Context命名空间 p命名空间 --> 3 <beans xmlns="http://www.springframework.org/schema/beans" 4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 5 xmlns:context="http://www.springframework.org/schema/context" 6 xmlns:p="http://www.springframework.org/schema/p" 7 xsi:schemaLocation="http://www.springframework.org/schema/beans 8 http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 9 http://www.springframework.org/schema/context 10 http://www.springframework.org/schema/context/spring-context-3.2.xsd"> 11 12 </beans>
1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xmlns="http://java.sun.com/xml/ns/javaee" 4 xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 5 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 6 http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 7 id="WebApp_ID" version="3.0"> 8 <display-name></display-name> 9 <welcome-file-list> 10 <welcome-file>redirect.jsp</welcome-file> 11 </welcome-file-list> 12 13 <!-- 指定配置信息位置 --> 14 <context-param> 15 <param-name>contextConfigLocation</param-name> 16 <param-value>classpath:applicationContext.xml</param-value> 17 </context-param> 18 19 <!-- 负责在web容器启动的时候,去读取特定的Spring IOC配置信息 --> 20 <listener> 21 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 22 </listener> 23 <!-- 配置DispatcherServlet --> 24 <servlet> 25 <!-- Spring 过滤的名称 --> 26 <servlet-name>springmvc</servlet-name> 27 <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 28 </servlet> 29 <servlet-mapping> 30 <servlet-name>springmvc</servlet-name> 31 <!-- 指定过滤的请求类型 --> 32 <url-pattern>*.html</url-pattern> 33 </servlet-mapping> 34 35 </web-app>