spring mvc 映射器和适配器

映射器和适配器

1、非注解的映射器和适配器

a. 入门程序中的单个映射

BeanNameUrlHandlerMapping

SimpleControllerHandlerAdapter

b.另一种mapping

 

c.另一种adapter

要求handler实现接口HttpRequestHandler

 

DemoController2

 

springmvc有默认的mapping adapter view。

/org/springframework/web/servlet/DispatcherServlet.properties

 

如果在springmvc.xml配置了一种,默认的就会失效。如配置了SimpleUrlHandlerMapping,则BeanNameUrlHandlerMapping就会失效。

2、注解的映射器和适配器

a. mapping 和 adapter

 

 

  Ps:注解的映射器和适配器要配对使用

b.controller

 

java

   

-xml

-----单个

 

-----组件扫描 context:component-scan

 

c.测试

http://localhost:8080/mybatis_spring/test001.action

index.jsp里面的是,<font size="18px">${msg }</font><br/>

 

原文地址:https://www.cnblogs.com/jway1101/p/5773694.html