Sturts1:核心控制器ActionServlet(org.apache.struts.action.ActionServlet),继承DispatchAction(struts.jar)
Dao层:(ibatis)继承spring.jar包SqlMapClientDaoSupport
Sturts2:核心控制器FilterDispatcher(org.apache.struts2.dispatcher.FilterDispatcher),继承ActionSupport(xwork.jar)
Dao层:(hibernate)继承spring-orm.jar包HibernateDaoSupport
SprintMVC:DispatcherServlet(org.springframework.web.servlet.DispatcherServlet)
Dao层:1.springjdbc SimpleJdbcTemplate
2.(hibernate)SimpleHibernateDao
注:1:spring配置文件:datasource+sessionFattory 连接数据库
2:daoimpl:数据库操作
(1) struts1+ibatis (hnzw)
(2) struts2+hibernate(ssh:简单-find ; wop:复杂-session.createSQLQuery -多数据源; hm_dzjc:复杂-this.createQuery-注解-) 单数据源:hm_dzjc,hnzw,ssh;
多数据源(连接池):wop
(3) springMVC(hm_dzjc:springjdbc)
spring容器,BeanFactory和ApplicationContext
1.jdbc
2.jdbc加载配置文件
3.jdbc加载proxool.xml(连接池)
4.hibernate
5.spring加载hibernate
6.spring加载配置文件(可单一,可多)- JNDI(dataSource)
7.spring加载proxool.xml(多,连接池)} - web.xml中加载proxool.xml
8.spring加载Ibatis - SqlMap只是用来映射,还需web.xml中用proxool
hibernate读取:
(
1.
2.
)
spring容器:
(
)
spring配置文件默认位置为/WEB-INF/下,这时在web.xml中可不用配置(路径),若在classpath下,则需要在web.xml中配置;
struts2配置文件默认路径为classpath下。
web.xml:
spring:
<!-- Spring配置 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:spring/*.xml</param-value> </context-param>
<!--Spring context loader(Struts2的Spring支持)-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
struts2:
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>