For faster navigation, this Iframe is preloading the Wikiwand page for Struts.

Struts

Apache Struts
原作者Craig McClanahan
开发者Apache软件基金会
首次发布2000年5月 (2000-05)
当前版本
  • 6.4.0 (2024年4月19日;稳定版本)[1]
编辑维基数据链接
编程语言Java
操作系统跨平台
平台跨平台 (JVM)
许可协议Apache License 2.0
网站struts.apache.org

StrutsApache软件基金会(ASF)赞助的一个开源项目。它最初是Jakarta项目中的一个子项目,并在2004年3月成为ASF的顶级项目。它通过采用Java ServletJSP技术,实现了基于Java EE Web应用的Model-View-Controller(MVC设计模式应用框架,是MVC经典设计模式中的一个经典产品。

MVC结构

在Struts中,已经由一个名为ActionServlet的Servlet充当 控制器Controller)的角色,根据描述模型、视图、控制器对应关系的struts-config.xml的配置文件,转发视图(View)的请求,组装响应数据模型(Model)。在MVC模型Model)部分,经常划分为两个主要子系统(系统的内部数据状态改变数据状态的逻辑动作),这两个概念子系统分别具体对应Struts 1里的ActionActionForm两个需要继承实现超类,Struts 2移除ActionForm[2]。在这里,Struts可以与各种标准的数据访问技术结合在一起,包括Enterprise Java Beans(EJB), JDBCJNDI。在Struts的视图View)端,除了使用标准的JavaServer Pages(JSP)以外,还提供了大量的标签库使用,同时也可以与其他表现层组件技术(产品)进行整合,比如Velocity Templates,XSLT等。通过应用Struts的框架,最终用户可以把大部分的关注点放在自己的业务逻辑(Action)与 映射关系的配置文件(struts-config.xml)中。

发展历程

Struts 2的合并示意图

Java EEWeb应用发展的初期,除了使用Servlet技术以外,普遍是在JavaServer Pages(JSP)的源代码中,采用HTMLJava代码混合的方式进行开发。因为这两种方式不可避免的要把表现与业务逻辑代码混合在一起,都给前期开发与后期维护带来巨大的复杂度。为了摆脱上述的约束与局限,把业务逻辑代码从表现层中清晰的分离出来,2000年,Craig McClanahan采用了MVC的设计模式开发Struts。后来该框架产品一度被认为是最广泛、最流行JAVA的WEB应用框架。

2006年,WebWork与Struts的Java EE Web框架的团体,决定合作共同开发一个新的,整合了WebWork与Struts优点,并且更加优雅、扩展性更强的框架,命名为“Struts 2”,原Struts的1.x版本产品称为“Struts 1”。Struts项目并行提供与维护两个主要版本的框架产品——Struts 1与Struts 2

在2008年12月,Struts1发布了最后一个正式版(1.3.10),而2013年4月5日,Struts开发组宣布终止了Struts 1的软件开发周期[3]

优缺点

此条目可能包含原创研究。请协助补充参考资料、添加相关内联标签和删除原创研究内容以改善这篇条目。详细情况请参见讨论页

Struts的优点主要集中体现在两个方面,Taglib和页面导航。Taglib是Struts的标记库,灵活动用,能大大提高开发效率。

Struts这个名字来源于在建筑和旧式飞机中使用的支持金属架。它的目的是为了减少在运用MVC设计模型来开发Web应用的时间。你仍然需要学习和应用该架构,不过它将可以完成其中一些繁重的工作。Struts跟Tomcat、Turbine等诸多Apache项目一样,是开源软件,这是它的一大优点,使开发者能更深入的了解其内部实现机制。

Struts2的漏洞处理机制常被诟病,一来OGNL的功能强大和请求处理机制极易产生远程执行问题,二来开发组对漏洞处理能力不足,要么修复后仍可以绕过,要么无法修复而长期闲置处理。[4]

参考文献

外部链接

参见

{{bottomLinkPreText}} {{bottomLinkText}}
Struts
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?