<bean
class=“org.springframework.web.servlet.view.InternalResourceViewResolver”>
3.4、配置web.xml文件
在web.xml文件中完成一下几件事:
1、配置springmvc的前端控制器(加载springmvc配置文件)
2、加载spring的配置文件
3、加载监听器
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xmlns=“http://xmlns.jcp.org/xml/ns/javaee” xsi:schemaLocation=“http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd” id=“WebApp_ID” version=“3.1”>
springmvcfirst
contextConfigLocation
/WEB-INF/classes/spring/applicationContext-*.xml
org.springframework.web.context.ContextLoaderListener
springmvc
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:spring/springmvc.xml
</s Java开源项目【ali1024.coding.net/public/P7/Java/git】 ervlet>
springmvc
*.action
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
3.5、三层整合配置文件总结
3.5.1、dao层
1、mybatis自己的配置文件sqlMapConfig.xml
实现别名定义、缓存设置等配置。
2、dao层spring配置文件applicationContext-dao.xml
完成数据源、SqlSessionFactory、mapper扫描器的配置。
3.5.2、service层
1、service层spring配置文件applicationContext-service.xml
管理service接口实现类的bean(注解方式)
2、spring管理事务的配置文件applicationContext-transaction.xml
实现事务控制、AOP
3.5.3、表现层配置文件springmvc.xml
配置Handler、处理器映射器、适配器、视图解析器。