(1)constructor-arg:通过构造函数注入;
property:通过setXX()方法注入;
(2)resultType:直接表示返回类型;
resultMap:表示对外部resultMap的引用。
其实sql语句执行后返回的都是resultMap,如果写了resultType系统则自动将resultMap转为对应的resultType,resultType和resultMap不能同时存在。
(3)可在mapper接口对应方法,指明参数名实现传入多个同类型参数或多个不同类型参数(此时就不用写parameterType了)
public int updateUserName(@Param("oldName")String oldName,@Param("newName")String newName);
(4)前端界面,通过web.xml设置的对应DispatcherServlet的url找到相应controller中的对应方法;在Dispatcher.xml设置的组件扫描器会扫描对应的controller类,po,service等;在mybatis.xml文件中根据配置的mapper扫描器找到mapper接口;
<form action="<span style="color:#ff0000;">user/login.do method="post">此请求界面在WebContent/test目录下
@RequestMapping("/test/user/")controller类要注解的请求映射
@RequestMapping("login.do")controller类中对应请求界面的方法注解
(5)controller处理前端请求界面发来的数据后,将处理后的数据,通过视图解析器找到对应前端界面
<!-- 视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/"></property> 前缀
<property name="suffix" value=".jsp"></property>后缀
</bean>
即在WebContent下找相应jsp文件;