[原创] Spring vs Struts ?
2006-12-20 22:59
225 查看
从严格上来说,Spring 和 Struts 没有太大的可比性,一个是为了挑战 EJB 而生的“无所不能”的“敏捷的”轻量级企业级系统框架,另一个是以稳定著称而且饱经检验的 J2EE 系统开发框架;但是我想说的是:虽然他们之间是很好的“合作伙伴”关系,但是另一方面,已经早已被默认为是“工业标准”的 Struts 正受到 Spring 强有力的挑战,他们之间还是很值得比较一下的。为什么这么说呢,让我们先分析一下吧 :)
其实石头一直认为采取合适的系统架构,就算不借助其他任何框架 Spring 也完全有能力胜任一个普通 J2EE 系统甚至是企业级系统的所有工作,因为他本身就提供了整套完善的系统解决方案,当然也包括自己的 DAO 理念和 MVC 架构。试想想看如果我们分别单独用 Struts 或者用 Spring 来做一个系统,他们会是什么样子呢,会产生什么样的问题,会有什么不同呢?所以为什么我们不先把两者比较一下呢?这样至少能搞清楚一些问题,也许还能从中发现一些有趣的事情呢。
众所周知,Struts 是众多 J2EE 开发框架中最早使用也是实现的最好的开发框架之一。那么我们就从 MVC 分层对比一下这两者吧。首先,在 View 层上,Struts 为开发者们提供了相当丰富的标签库,这些相信大家都已经非常熟悉了;然而在这一层上 Spring 也丝毫不落下风,特别是在 Spring2.0 中,将提供更加丰富的 JSP 标签库,而且其中绝大部分都是 Spring 用户通过投票方式产生的;另外,当然两者都支持与其他的模板视图组合(如:Velocity、FreeMark等)。其次,再让我们从 Control 层上来比较两者:Struts 的 Control 层的核心是 ActionSerlet 而 Spring 是更为强大而全面的 DispatchSerlet,Struts 主要通过在 struts-config.xml 文件中对相应元素的配置来完成几乎所有的配置,而 Spring 则不同,他提倡将应用上下文分散到应用系统的各个层次中(WEb层、业务层、持久层),配置文件分别对应为 xxx-servlet.xml、xxx-service.xml、xxx-data.xml,而我们可以在 xxx-servlet.xml 配置控制器,另外,Spring 提出的 IoC 机制也让配置功能更加有针对性也更加灵活。而从控制器本身来看,相比 Struts 或 Webwork 比较平坦的 Action 层次,Spring 提供了更加丰富的控制器层次,如图所示:
更详细的介绍可见《Spring in Action》8.3 节。
最后说说最重要的 Module 部分把,实际上 Struts 框架并没有为设计和创建模型组件提供现成的框架,与其不同的是 Spring 却拥有自己独特的 DAO 理念,而且 Spring 的 DAO 框架伴随着一套非常丰富的分级异常体系,如 DataAccessResourceFailureException、DataIntegrityViolationException、CleanupFailureDataAccessException 等,由于篇幅限制不在这里具体介绍了,可参考《Spring in Action》4.1 节。另外在对其他 ORM 框架的支持方面 Spring 也做的很棒,比如支持 Hibernate 的 HibernateTemplate,还有为 iBatis 提供的 SqlMapClientTemplate 等,都是非常方便而强大的工具,相信已经有无数的 Programmer 从中得到了好处吧 :)
以下是自己配的一个 Spring + Struts + Hibernat 系统中的 applicationContext.xml 配置文件的示例,希望对初学者有点参考作用:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<?xml version="1.0" encoding="UTF-8"?>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<beans>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="driverClassName">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<value>org.gjt.mm.mysql.Driver</value>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="url">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<value>jdbc:mysql://10.28.4.219:3306/spring?useUnicode=true</value>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="username">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<value>root</value>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="password">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<value>123456</value>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</bean>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!-- 配置sessionFactory, 注意使用Hibernat3应该在这里引入hibernate3包 -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="dataSource">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<ref local="dataSource" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="mappingResources">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<list>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<value>com/spring/module/data/spring/Users.hbm.xml</value>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</list>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="hibernateProperties">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<props>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<prop key="hibernate.show_sql">true</prop>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</props>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</bean>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="sessionFactory">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<ref local="sessionFactory" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</bean>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!-- 配置自己的hibernate DAO类 -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<bean id="usersDAO" class="com.spring.module.data.spring.dao.UsersDAOImp">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="sessionFactory">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<ref local="sessionFactory" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</bean>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!-- 配置usersDAOProxy, 注意这里应该注入上面声明过的usersDAO -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<bean id="usersDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="transactionManager">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<ref bean="transactionManager" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="target">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<ref local="usersDAO" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="transactionAttributes">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<props>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<prop key="insert*">PROPAGATION_REQUIRED</prop>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</props>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</bean>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!-- 处理 Struts 交由处理的 Action 转发 -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<bean name="/login" class="com.spring.action.LoginAction" singleton="false">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="usersDAO">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<ref bean="usersDAOProxy" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</bean>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
... ... ...
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</beans>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
好了,说了这么多,一个字,累 ~~ 不过总算对他们进行了粗略的比较,他们更多的长处或者短处还是留给大家在继续深入的学习过程中慢慢体会总结吧。话说回来,虽然现在大部分的人都觉得 Spring + Struts + Hibernate 组合是 J2EE 项目中最完美的组合,把业务逻辑全权交由 Spring 来处理也很让人放心,但是这种复杂的中间层组合是否对程序效率会产生负面的影响还有待设计人员好好斟酌了 ... 最后,文章欢迎大家的批评和指正,希望大家能多多支持 :)
其实石头一直认为采取合适的系统架构,就算不借助其他任何框架 Spring 也完全有能力胜任一个普通 J2EE 系统甚至是企业级系统的所有工作,因为他本身就提供了整套完善的系统解决方案,当然也包括自己的 DAO 理念和 MVC 架构。试想想看如果我们分别单独用 Struts 或者用 Spring 来做一个系统,他们会是什么样子呢,会产生什么样的问题,会有什么不同呢?所以为什么我们不先把两者比较一下呢?这样至少能搞清楚一些问题,也许还能从中发现一些有趣的事情呢。
众所周知,Struts 是众多 J2EE 开发框架中最早使用也是实现的最好的开发框架之一。那么我们就从 MVC 分层对比一下这两者吧。首先,在 View 层上,Struts 为开发者们提供了相当丰富的标签库,这些相信大家都已经非常熟悉了;然而在这一层上 Spring 也丝毫不落下风,特别是在 Spring2.0 中,将提供更加丰富的 JSP 标签库,而且其中绝大部分都是 Spring 用户通过投票方式产生的;另外,当然两者都支持与其他的模板视图组合(如:Velocity、FreeMark等)。其次,再让我们从 Control 层上来比较两者:Struts 的 Control 层的核心是 ActionSerlet 而 Spring 是更为强大而全面的 DispatchSerlet,Struts 主要通过在 struts-config.xml 文件中对相应元素的配置来完成几乎所有的配置,而 Spring 则不同,他提倡将应用上下文分散到应用系统的各个层次中(WEb层、业务层、持久层),配置文件分别对应为 xxx-servlet.xml、xxx-service.xml、xxx-data.xml,而我们可以在 xxx-servlet.xml 配置控制器,另外,Spring 提出的 IoC 机制也让配置功能更加有针对性也更加灵活。而从控制器本身来看,相比 Struts 或 Webwork 比较平坦的 Action 层次,Spring 提供了更加丰富的控制器层次,如图所示:
类 名 | 描 述 |
---|---|
Controller AbstractController | 这两个控制器比较简单,功能和 Java Servlet 差不多。 |
ThrowawayController | 一次性控制器。你需要像命令那样简单的请求处理方式(类似于 Webwork 的 Action)。 |
MutiActionController | 多动作控制器。应用系统中有多个动作处理相似或逻辑相关时常用。 |
BaseCommandController AbstractCommandController | 命令控制器。会从请求一个或多个参数,然后将他们绑定到一个对象中。而且提供参数验证的功能。 |
AbstractFormController SimpleFormController | 表单控制器。需要给用户显示一个输入表单。并且处理输入表单的数据。 |
AbstractWizardFormController | 向导控制器。你要带领用户通过一个复杂的、多页的输入表单,最后按一个表单处理。 |
最后说说最重要的 Module 部分把,实际上 Struts 框架并没有为设计和创建模型组件提供现成的框架,与其不同的是 Spring 却拥有自己独特的 DAO 理念,而且 Spring 的 DAO 框架伴随着一套非常丰富的分级异常体系,如 DataAccessResourceFailureException、DataIntegrityViolationException、CleanupFailureDataAccessException 等,由于篇幅限制不在这里具体介绍了,可参考《Spring in Action》4.1 节。另外在对其他 ORM 框架的支持方面 Spring 也做的很棒,比如支持 Hibernate 的 HibernateTemplate,还有为 iBatis 提供的 SqlMapClientTemplate 等,都是非常方便而强大的工具,相信已经有无数的 Programmer 从中得到了好处吧 :)
以下是自己配的一个 Spring + Struts + Hibernat 系统中的 applicationContext.xml 配置文件的示例,希望对初学者有点参考作用:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<?xml version="1.0" encoding="UTF-8"?>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<beans>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="driverClassName">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<value>org.gjt.mm.mysql.Driver</value>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="url">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<value>jdbc:mysql://10.28.4.219:3306/spring?useUnicode=true</value>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="username">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<value>root</value>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="password">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<value>123456</value>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</bean>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!-- 配置sessionFactory, 注意使用Hibernat3应该在这里引入hibernate3包 -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="dataSource">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<ref local="dataSource" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="mappingResources">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<list>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<value>com/spring/module/data/spring/Users.hbm.xml</value>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</list>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="hibernateProperties">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<props>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<prop key="hibernate.show_sql">true</prop>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</props>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</bean>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="sessionFactory">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<ref local="sessionFactory" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</bean>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!-- 配置自己的hibernate DAO类 -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<bean id="usersDAO" class="com.spring.module.data.spring.dao.UsersDAOImp">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="sessionFactory">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<ref local="sessionFactory" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</bean>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!-- 配置usersDAOProxy, 注意这里应该注入上面声明过的usersDAO -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<bean id="usersDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="transactionManager">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<ref bean="transactionManager" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="target">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<ref local="usersDAO" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="transactionAttributes">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<props>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<prop key="insert*">PROPAGATION_REQUIRED</prop>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</props>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</bean>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!-- 处理 Struts 交由处理的 Action 转发 -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<bean name="/login" class="com.spring.action.LoginAction" singleton="false">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="usersDAO">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<ref bean="usersDAOProxy" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</bean>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
... ... ...
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</beans>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
好了,说了这么多,一个字,累 ~~ 不过总算对他们进行了粗略的比较,他们更多的长处或者短处还是留给大家在继续深入的学习过程中慢慢体会总结吧。话说回来,虽然现在大部分的人都觉得 Spring + Struts + Hibernate 组合是 J2EE 项目中最完美的组合,把业务逻辑全权交由 Spring 来处理也很让人放心,但是这种复杂的中间层组合是否对程序效率会产生负面的影响还有待设计人员好好斟酌了 ... 最后,文章欢迎大家的批评和指正,希望大家能多多支持 :)
相关文章推荐
- Struts VS Spring 两种MVC框架
- 【原创】Struts+Hibernate+Spring例子..
- Struts VS Spring 两种MVC框架
- 图解MyEclipse配置struts+hibernate+spring+FreeMarker【原创】
- Struts VS Spring两种MVC框架比较
- 简介Struts VS Spring 两种MVC框架
- SpringMVC vs Struts
- Struts VS Spring 两种MVC框架比较
- 图解MyEclipse配置struts+hibernate+spring+FreeMarker【原创】
- Struts VS Spring 两种MVC框架比较
- 【原创】如何建立 SSH 项目 (Struts1 + Spring + Hibernate)
- Struts VS Spring 两种MVC框架比较
- Struts VS Spring两种MVC框架比较
- Hibernate/Spring/Struts架构使用OpenSessionInView的问题
- 原创:体验spring(一)
- Spring,hibernate,struts的面试笔试题(含答案)
- spring整合struts2时action里的service注入不进来,报空指针异常
- Java-Spring+Struts+Hibernate-SSH框架整合01-Spring+Hibernate
- 图解MyEclipse配置struts+hibernate+spring
- Struts+Spring+Hibernate 分析