首页 > 编程语言 > 详细

spring mvc spring-mvc.xml 配置

时间:2019-12-13 14:26:48      阅读:85      评论:0      收藏:0      [点我收藏+]

说明

<?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:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">

	<!-- 组件扫描 -->
	<context:component-scan base-package="com.atguigu.springmvc"></context:component-scan>
	
	<!-- 视图解析器 -->
	<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/WEB-INF/views/"></property>
		<property name="suffix" value=".jsp"></property>
	</bean>
	<!-- 
		将在 SpringMVC 上下文中定义一个 DefaultServletHttpRequestHandler,
		它会对进入 DispatcherServlet 的请求进行筛查,如果发现是没有经过映射的请求,
		就将该请求交由 WEB 应用服务器默认的 Servlet 处理,如果是由映射的请求,才由 DispatcherServlet 继续处理
		
		如果web应用服务器的默认的Serlvet的名字不叫"default",则需要通过default-servlet-name来进行指定.
		
		配置了default-serlvet-handler后,RequestMapping的映射会失效,需要加上annotation-driven的配置。		
	 -->
	<mvc:default-servlet-handler />
	<!--  -->
	<mvc:annotation-driven/>
</beans>

  

spring mvc spring-mvc.xml 配置

原文:https://www.cnblogs.com/liubosong/p/12034847.html

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