首页 > 代码库 > spring mvc 头部及配置HandlerMapping HandlerAdapter controller

spring mvc 头部及配置HandlerMapping HandlerAdapter controller

<?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:aop="http://www.springframework.org/schema/aop"
	xmlns:c="http://www.springframework.org/schema/c" xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
	
	<!--扫描所有的注解类
	<context:component-scan base-package="controller"></context:component-scan>
	  -->
	
	<!--配置HandlerMapping  	-->
	<bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"></bean>

	<!--配置HandlerAdapter  	-->
	<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"></bean>

	<!-- 配置渲染器  
		p:prefix:设置路径的前缀 
	    p:suffix:设置路径的后缀 
	-->
	<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/" p:suffix=".jsp"></bean>
	
	<!-- 配置controller -->
	<bean name="/test.do" class="controller.controller"></bean>
	
	
	
</beans>

  

spring mvc 头部及配置HandlerMapping HandlerAdapter controller