Struts2 is really WebWork 2 renamed as Struts2. Consider for a moment the fact that Struts essentially leveraged its own brand name to adopt WebWork as its new base, and that should suggest to you that there was at least some who felt it was very compelling -- one doesn't always throw out their own code base to start anew when they issue a sequel.
That said, I'm not going to tell you that Struts2 is better/worse than Spring 3 MVC. Bottom line is that they are definitely comparable.
If you want more details on how they compare, I suggest you check out Matt Raible's presentations in years past on this topic:
Well Both Struts2 and Spring3 are very much similar in many respects.Both are action oriented framework and much same in the flow.Spring MVC came out due to all known limitations of Struts1. but when you come to choose Struts2 vs Spring3 MVC there is not much you can differentiate and both are well designed and good framework. for Struts2 as its webwork based framework but with lots of improvements over webwork.one major advantage is UI tags support for Struts2 regarding spring3 mvc its equally good and powerfull positive side is its well and very deep integration with Spring framework.
We are using Struts2 with Spring DI and transcation management in our few projects and in some using Spring MVC. it only matters you choice and your brand inclination.
edit
In my opinion its not a good practice to compare like designed framework,better come up with your requirements what exactly are the requirements of your project than do a analysis which framework provides best and very similar requirements as per your needs rather than doing a plain comparasion
Configurable MVC components, which are stored in struts.xml file. If you want to change anything, you can easily do it in the xml file.
POJO based actions. Struts 2 action class is Plain Old Java Object, which prevents developers to implement any interface or inherit any class.
Support for Ajax, which is used to make asynchronous request. It only sends needed field data rather than providing unnecessary information, which at the end improves the performance.
Support for integration with Hibernate, Spring, Tiles and so on.
Whether you want to use JSP, freemarker, velocity or anything else, you can use different kinds of result types in Struts 2.
You can also leverage from various tags like UI tags, Data tags, control tags and more.
Brings ample support for theme and template. Struts 2 supports three different kinds of themes including xhtml, simple and css_xhtml.
Spring MVC
Neat and clear separation of roles. Whether it is controller, command object, form object or anything else, it can be easily fulfilled with the help of a specialized object.
Leverage from the adaptability, non-intrusiveness and flexibility with the help of controller method signature.
Now use existing business objects as command or form object rather than duplicating them to extend the specific framework base class.
Customizable binding and validation will enable manual parsing and conversion to business objects rather than using conventional string.
Flexible mode transfer enables easy integration with the latest technology.
Customizable locale and theme resolution, support for JSPs with or without Spring tag library for JSTL and so on.
Leverage from the simle, but powerful JSP tag library known as Spring tag library. It provides support for various features like data binding and themes.
BENEFITS COMPARING
Struts 2
Simplified design
Ease of using plug-in
Simplified ActionForm & annotations
Far better tag features
OGNL integration
AJAX Support
Spring MVC
Clear separation between controllers, JavaBeans models and views that is not possible in Struts.
Spring MVC is more flexible as compared to the Struts.
Spring can be used with different platforms like Velocity, XLST or various other view technologies.
There is nothing like ActionForm in Spring, but binds directly to the domain objects.
Code is also more testable as compared to the Struts.
It is a complete J2EE framework comprising of seven independent layers, which simplifies integration with other frameworks.
It doesn’t provide a framework for implementing the business domain and logic, which helps developers create a controller and a view for the application.
1)struts2 tags and
2)struts 2 plugins and
3)struts2 plugin framework using freemarker makes struts2-jquery-plugin and config-browser-plugin
struts 2 约定允许您在 xml 中无需创建操作类,甚至注释和零配置。它只是为了使其在纸上看起来不错,但在所有真正的大型项目中,您将需要编写注释。 如果您在运行时迷失在注释中,有一种方法可以在开发模式下找到浏览器中的配置,请尝试 config-browser-plugin。
请记住,Struts/spring MVC 仅由 Web 应用程序的一小部分组成,直至前端控制器。
I would answer in a opinionated way as I have not used spring MVC much.
Use struts2 for
1)struts2 tags and
2)struts 2 plugins and
3)struts2 plugin framework using freemarker makes struts2-jquery-plugin and config-browser-plugin
The struts 2 convention allows you to create action class without even annotations and zero configuration in xml. Its just to make it look good in paper however in all real big projects you will need to write annotations. If you get lost among annotations during runtime there is a way to find out the configuration in browser in dev mode, try config-browser-plugin.
Remember Struts/spring MVC consists of a very small part of a web application only upto the front controller.
Not to be snide, but if it's worth your time to consider a framework choice, then it's also worth your time to stand up some spikes against you most important couple of high level user stories. Both Struts2 and Spring MVC 3 have very easily set up demo enviroments, i.e. you can get a maven archetype running out of your IDE in less than 5 minutes.
I've been involved in panel discussions about which framework is better, and I truly believe that no amount of discussion is worth the time. You're much better served by playing with the frameworks in the context of your use cases.
If you know the difference between struts 1 and spring 2.5, ask yourself instead what difference there is between struts 1 and 2, and spring 2.5 and 3 respectively. In the latter, there's the refinement of webmvc with validation, xml marshalling, rest etc. See What's New in Spring 3.0, for struts see What's new in Struts 2.0.
正如Umesh所说,spring3 MVC的积极的一面是它与Spring的深度集成。 在我的一个项目中,我使用专有的 DI 框架,因此 Struts2 是显而易见的选择(我们不想同时使用两个 DI 框架)
Struts2 是成熟且广泛使用的 Web 框架,具有非常活跃的社区支持。 Spring3是一个大框架,有很多模块,包括spring mvc。
As Umesh said, Positive side of spring3 MVC is that it has deep integration with Spring. In one of my project, I was using proprietary DI framework so Struts2 was obvious choice ( we didn't wanted two DI framework together)
Struts2 is matured and widely used web-framework with very active community support. Spring3 is big framework with many modules including spring mvc.
发布评论
评论(8)
Struts2 实际上是 WebWork 2 更名为 Struts2。考虑一下这样一个事实:Struts 本质上是利用自己的品牌名称来采用 WebWork 作为其新基础,这应该向您表明,至少有一些人认为它非常引人注目——人们并不总是抛弃他们的想法。当他们发布续集时,可以重新开始自己的代码库。
也就是说,我不会告诉您 Struts2 比 Spring 3 MVC 更好/更差。底线是它们绝对具有可比性。
如果您想了解有关它们如何比较的更多详细信息,我建议您查看 Matt Raible 过去几年关于此主题的演示:
http://raibledesigns .com/rd/entry/my_comparing_jvm_web_frameworks
http://static.raibledesigns.com/repository/ presents/ComparingJavaWebFrameworks-ApacheConUS2007.pdf
包括一个电子表格,在不同程度上比较了其中的几个:
http://spreadsheets.google.com/pub?key=0AtkkDCT2WDMXdC1HOEtnUHpCejJMbUhGeGJWUmh5dVE&hl=en&output=html
Struts2 is really WebWork 2 renamed as Struts2. Consider for a moment the fact that Struts essentially leveraged its own brand name to adopt WebWork as its new base, and that should suggest to you that there was at least some who felt it was very compelling -- one doesn't always throw out their own code base to start anew when they issue a sequel.
That said, I'm not going to tell you that Struts2 is better/worse than Spring 3 MVC. Bottom line is that they are definitely comparable.
If you want more details on how they compare, I suggest you check out Matt Raible's presentations in years past on this topic:
http://raibledesigns.com/rd/entry/my_comparing_jvm_web_frameworks
http://static.raibledesigns.com/repository/presentations/ComparingJavaWebFrameworks-ApacheConUS2007.pdf
including a spreadsheet that compares several of them on various degrees:
http://spreadsheets.google.com/pub?key=0AtkkDCT2WDMXdC1HOEtnUHpCejJMbUhGeGJWUmh5dVE&hl=en&output=html
Struts2 和 Spring3 在很多方面都非常相似。两者都是面向操作的框架,并且在流程上非常相似。Spring MVC 的出现是由于 Struts1 的所有已知限制。
但是当您选择 Struts2 与 Spring3 MVC 时,您没有太多区别,而且两者都设计良好且框架良好。
Struts2 作为其基于 Webwork 的框架,但比 Webwork 有很多改进。一个主要优点是对 Struts2 的 UI 标签支持
对于 spring3 mvc 来说,它同样优秀和强大的积极一面是它与 Spring 框架的良好且非常深入的集成。
我们在少数项目中使用 Struts2 和 Spring DI 以及事务管理,并且在一些项目中使用 Spring MVC。
重要的是您的选择和您的品牌倾向。
编辑
在我看来,比较类似设计的框架不是一个好的做法,最好提出您的需求,您的项目的需求到底是什么,而不是分析哪个框架提供了最好的且非常相似的需求您的需求而不是进行简单的比较
Well Both Struts2 and Spring3 are very much similar in many respects.Both are action oriented framework and much same in the flow.Spring MVC came out due to all known limitations of Struts1.
but when you come to choose Struts2 vs Spring3 MVC there is not much you can differentiate and both are well designed and good framework.
for Struts2 as its webwork based framework but with lots of improvements over webwork.one major advantage is UI tags support for Struts2
regarding spring3 mvc its equally good and powerfull positive side is its well and very deep integration with Spring framework.
We are using Struts2 with Spring DI and transcation management in our few projects and in some using Spring MVC.
it only matters you choice and your brand inclination.
edit
In my opinion its not a good practice to compare like designed framework,better come up with your requirements what exactly are the requirements of your project than do a analysis which framework provides best and very similar requirements as per your needs rather than doing a plain comparasion
(来源http://www.cygnet-infotech.com/blog/struts -2-vs-springmvc)
(Source http://www.cygnet-infotech.com/blog/struts-2-vs-springmvc)
我会以一种固执己见的方式回答,因为我没有太多使用 Spring MVC。
使用 struts2
struts 2 约定允许您在 xml 中无需创建操作类,甚至注释和零配置。它只是为了使其在纸上看起来不错,但在所有真正的大型项目中,您将需要编写注释。
如果您在运行时迷失在注释中,有一种方法可以在开发模式下找到浏览器中的配置,请尝试 config-browser-plugin。
请记住,Struts/spring MVC 仅由 Web 应用程序的一小部分组成,直至前端控制器。
I would answer in a opinionated way as I have not used spring MVC much.
Use struts2 for
The struts 2 convention allows you to create action class without even annotations and zero configuration in xml. Its just to make it look good in paper however in all real big projects you will need to write annotations.
If you get lost among annotations during runtime there is a way to find out the configuration in browser in dev mode, try config-browser-plugin.
Remember Struts/spring MVC consists of a very small part of a web application only upto the front controller.
不是讽刺,但如果值得您花时间考虑框架选择,那么也值得您花时间针对最重要的几个高级用户故事进行一些尖峰。 Struts2 和 Spring MVC 3 都可以非常轻松地设置演示环境,即您可以在 5 分钟内从 IDE 中获得运行的 Maven 原型。
我参与过关于哪种框架更好的小组讨论,我坚信再多的讨论都不值得花时间。在您的用例上下文中使用框架会为您提供更好的服务。
Not to be snide, but if it's worth your time to consider a framework choice, then it's also worth your time to stand up some spikes against you most important couple of high level user stories. Both Struts2 and Spring MVC 3 have very easily set up demo enviroments, i.e. you can get a maven archetype running out of your IDE in less than 5 minutes.
I've been involved in panel discussions about which framework is better, and I truly believe that no amount of discussion is worth the time. You're much better served by playing with the frameworks in the context of your use cases.
如果您知道 struts 1 和 spring 2.5 之间的区别,那么问问自己 struts 1 和 2、spring 2.5 和 3 之间分别有什么区别。后者对 webmvc 进行了改进,包括验证、xml 编组、休息等。请参阅 Spring 3.0 中的新增功能,对于 struts,请参阅 Struts 2.0 中的新增功能。
If you know the difference between struts 1 and spring 2.5, ask yourself instead what difference there is between struts 1 and 2, and spring 2.5 and 3 respectively. In the latter, there's the refinement of webmvc with validation, xml marshalling, rest etc. See What's New in Spring 3.0, for struts see What's new in Struts 2.0.
正如Umesh所说,spring3 MVC的积极的一面是它与Spring的深度集成。
在我的一个项目中,我使用专有的 DI 框架,因此 Struts2 是显而易见的选择(我们不想同时使用两个 DI 框架)
Struts2 是成熟且广泛使用的 Web 框架,具有非常活跃的社区支持。 Spring3是一个大框架,有很多模块,包括spring mvc。
As Umesh said, Positive side of spring3 MVC is that it has deep integration with Spring.
In one of my project, I was using proprietary DI framework so Struts2 was obvious choice ( we didn't wanted two DI framework together)
Struts2 is matured and widely used web-framework with very active community support. Spring3 is big framework with many modules including spring mvc.
Struts 2 在过去两年中遭受了许多安全漏洞的困扰,这一事实值得考虑。
http://www.cvedetails.com/product/6117/Apache -Struts.html?vendor_id=45
http://www.cvedetails.com /vendor/9664/Springsource.html
Struts 2 has suffered from a number of security vulnerabilities in the last two years and this fact should be considered.
http://www.cvedetails.com/product/6117/Apache-Struts.html?vendor_id=45
http://www.cvedetails.com/vendor/9664/Springsource.html