4.Why Struts 2

Struts2结合了Struts行动框架和Webwork的特点,简化了设计与动作处理,引入了控制反转,取消了ActionForm,提高了测试性,并支持智能默认配置。其动作类更加简单,可使用Java注解进行配置,同时支持AJAX特性。

The new version Struts 2.0 is a combination of the Sturts action framework and Webwork. According to the Struts 2.0.1 release announcement, some key features are:

  • Simplified Design - Programming the abstract classes instead of interfaces is one of design problem of struts1 framework that has been resolved in the struts 2 framework. Most of the Struts 2 classes are based on interfaces and most of its core interfaces are HTTP independent. Struts 2 Action classes are framework independent and are simplified to look as simple POJOs. Framework components are tried to keep loosely coupled.
  • Simplified Actions  - Actions are simple POJOs. Any java class with execute() method can be used as an Action class. Even we don't need to implement interfaces always. Inversion of Control is introduced while developing the action classes. This make the actions to be neutral to the underlying framework .
  • No more ActionForms  - ActionForms feature is no more known to the struts2 framework. Simple JavaBean flavored actions are used to put properties directly. No need to use all String properties.
  • Simplified testability - Struts 2 Actions are HTTP independent and framework neutral. This enables to test struts applications very easily without resorting to mock objects.
  • Intelligent Defaults - Most configuration elements have a default value which can be set according to the need. Even there are xml-based default configuration files that can be overridden according to the need.
  • Improved  results - Unlike ActionForwards, Struts 2 Results provide flexibility to create multiple type of outputs and in actual it helps to prepare the response.
  • Better Tag features - Struts 2 tags enables to add style sheet-driven markup capabilities, so that we can create consistent pages with less code. Struts 2 tags are more capable and result oriented. Struts 2 tag markup can be altered by changing an underlying stylesheet. Individual tag markup can be changed by editing a FreeMarker template. Both JSP and FreeMarker tags are fully supported.
  • Annotations introduced : Applications in struts 2 can use Java 5 annotations as an alternative to XML and Java properties configuration. Annotations minimize the use of xml.
  • Stateful Checkboxes - Struts 2 checkboxes do not require special handling for false values.
  • QuickStart - Many changes can be made on the fly without restarting a web container.
  • customizing controller - Struts 1 lets to customize the request processor per module, Struts 2 lets to customize the request handling per action, if desired.
  • Easy Spring integration - Struts 2 Actions are Spring-aware. Just need to add Spring beans!
  • Easy plugins - Struts 2 extensions can be added by dropping in a JAR. No manual configuration is required!
  • AJAX support - The AJAX theme gives interactive applications a significant boost.
    The framework provides a set of tags to help you ajaxify your applications, even on Dojo. The AJAX features include:
    1. AJAX Client Side Validation
    2. Remote form submission support (works with the submit tag as well)
    3. An advanced div template that provides dynamic reloading of partial HTML
    4. An advanced template that provides the ability to load and evaluate JavaScript remotely
    5. An AJAX-only tabbed Panel implementation
    6. A rich pub-sub event model
    7. Interactive auto complete tag
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值