ssm对应的是spring+springmvc+mybatis,

一、spring,略。

二、spring mvc是spring提供的mvc模块,

ssm框架的总结

从图中可以看出,springmvc的模块划分非常多,每一个模块都需要自己选择一种实现(有springmvc实现的)。

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4     xmlns:p="http://www.springframework.org/schema/p"
 5     xmlns:tx="http://www.springframework.org/schema/tx"
 6     xmlns:context="http://www.springframework.org/schema/context"
 7     xmlns:mvc="http://www.springframework.org/schema/mvc"
 8     xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
 9         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
10         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
11         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
12 
13     <!-- 处理器映射器 ,下面使用spring提供的映射器BeanNameUrlHandlerMapping,
14         是根据处理器的name和class属性来进行映射的,name就是url,class就是映射到的处理类
15         这是非注解的映射器的一种
16     -->
17     <bean 
18         class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />
19 
20     <!-- 处理器适配器 :所有的适配器都实现了HandlerAdapter接口,
21         而在适配器实现的support方法中,springmvc还要求通过该适配器适配的类必须实现指定的接口,
22         例如下面的处理器是通过SimpleControllerHandlerAdapter进行适配的,就必须实现Controller接口
23     -->
24     <bean 
25         class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
26 
27     <!-- 处理器 -->
28     <bean name="/queryitems.action" class="com.dqxst.controller.ItemsContraller" />
29 
30     <!-- 视图解析器 :解析jsp视图,默认使用jstl标签-->
31     <bean 
32         class="org.springframework.web.servlet.view.InternalResourceViewResolver">
33         <!-- 添加前缀和后缀,在指定视图时会和参数字串进行拼合 -->
34         <property name="prefix" value="/WEB-INF/jsp/" />
35         <property name="suffix" value=".jsp" />
36     </bean>
37     
38     <!-- 配置注解处理器适配器和映射器 ,这个是3.1之后新增的,不要使用之前的(在配置文件中的默认配置,可以被覆盖)
39         注意:如果使用注解开发,映射器和适配器必须都使用注解型
40     <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" />
41     <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter" />
42     -->
43     <!-- 但是使用下面的可以替换上面的配置,并且还加载了很多参数绑定的方法,例如json转换的解析器,开发时一般使用 -->
44     <mvc:annotation-driven></mvc:annotation-driven>
45     
46     <!-- 使用注解之后的组件可以单独配置,但是开发中一般使用扫描的方式
47         这样可以扫描controller、service、Repository等组件
48      -->
49     <context:component-scan base-package="com.dqxst.controller"></context:component-scan>
50 </beans>
springmvc各模块的一些实现配置

相关文章: