首页 > 编程语言 > 详细

Spring MVC配置详解(2)---bai

时间:2017-01-11 09:06:05      阅读:183      评论:0      收藏:0      [点我收藏+]
web.xml


<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
	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_2_5.xsd">
	<servlet>
		<servlet-name>springmvc</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>springmvc</servlet-name>
		<url-pattern>*.html</url-pattern>
	</servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

  

springmvc-servlet.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation=
	"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
	 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
	
	<!-- 配置注解的扫描路径。控制器包中 -->
	<context:component-scan base-package="com.etc.controller"/>
	
	<!-- 创建1个视图解析器,支持jsp -->
	<bean id="viewResovler" 
		class="org.springframework.web.servlet.view.UrlBasedViewResolver">		
		<!-- 视图文件的前缀 -->
		<property name="prefix" value="/WEB-INF/jsp/"/>
		<!-- 视图文件的后缀 -->
		<property name="suffix" value=".jsp"/>
		<!-- 视图文件的具体类型 -->
		<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>	
	</bean>
	
	
</beans>

  

Spring MVC配置详解(2)---bai

原文:http://www.cnblogs.com/ipetergo/p/6272264.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!