【PHP开源代码栏目提醒】:以下是网学会员为您推荐的PHP开源代码-Struts外文翻译 - 学士论文,希望本篇文章对您学习有所帮助。
附录 1 Struts Struts 是 Apache
软件基金会(ASF)赞助的一个
开源项目。
它最初是 Jakarta 项目中的一个子项目,并在 2004 年 3 月成为 ASF 的顶级项目。
它通过采用 Java Servlet/JSP 技术,实现了基于 Java EE Web 应用的 Model-View-Controller(MVC)设计模式的应用框架(Web Framework),是 MVC 经典
设计模式中的一个经典产品。
MVC 结构 在 Struts 中 , 已 经 由 一 个 名 为 ActionServlet 的 Servlet 充 当 控 制 器(Controller)的角色,根据描述模型、视图、控制器对应关系的 struts-config.xml 的配置文件,转发视图(View)的请求,组装响应数据模型 。
(Model) 在 MVC 的 模型(Model)部分,经常划分为两个主要子系统(
系统的内部数据状态与改变数据状态的逻辑动作),这两个概念子系统分别具体对应 Struts 里的 ActionForm 与 Action 两个需要继承实现超类。
在这里,Struts 可以与各种标准的数据访问技术结合在一起,包括 Enterprise JavaBeans 在 (EJB) JDBC 与 JNDI。
Struts 的视图(View) 端,除了使用标准的 JavaServerPages(JSP)以外,还提供了大量的标签库使用,同时也可以与其他表现层组件技术(产品)进行整合,比如 Velocity Templates,XSLT 等。
通过应用 Struts 的框架,最终用户 可 以 把 大 部 分 的 关 注 点 放 在 自 己 的 业 务 逻 辑 ( Action ) 与 映 射 关 系 的 配 置 文 件(struts-config.
xml)中。
发展历程 在 Java EE 的 Web 应用发展的初期,除了使用 Servlet 技术以外,普遍是在JavaServer Pages (
JSP)的源
代码中,采用 HTML 与 Java
代码混合的方式进行开发。
因为这两种方式不可避免的要把表现与业务逻辑
代码混合在一起,都给前期开发与后期维护带来巨大的复杂度。
为了摆脱上述的约束与局限,把业务逻辑
代码从表现层中清晰的分离出来,2000 年,Craig McClanahan 采用了 MVC 的设计模式开发 Struts。
后来该框架产品一度被认为是最广泛、最流行 JAVA 的 WEB 应用框架。
2006 年,WebWork 与 Struts 这两个优秀的 Java EE Web 框架(Web Framework)的团体,决定合作共同开发一个新的,整合了 WebWork 与 Struts 优点,并且更加优雅、扩展性更强的框架,命名为 “Struts 2” 。
,原 Struts 的 1.x 版本产品称为”Struts 1” 至此,Struts 项目并行提供与维护两个主要版本的框架产品——Struts 1 与 Struts2。
充满竞争的 MVC 框架 虽然 Struts 的是成熟的和流行的框架,建设前端 Java 应用,它正面临新的挑战,从较新的”轻量”的 MVC 框架,如 Spring 的 MVC ,Stripes 和 Tapestry 。
新的 XForms 标准和框架,也可能是另一种选择,以建立复杂的 Web 窗体验证与 Struts 的未来。
在 WebWork 框架脱离 Apache 的 Struts 的几年前,以提供改进和完善,同时保持了相同的一般建筑的原始 Struts 框架。
然而,它在 2005 年 12 月宣布,该框架将重新合并WebWork 。
WebWork 2.2 已获得通过,成为 Apache 的 Struts 的 2 ,达到了第一个完整的版本于 2007 年 2 月。
Sun 公司最近提出了一项新的除了 Java 平台,所谓的 JavaServer 界面(SF) 。
除了原有的框架下, Apache 的 Struts 的项目还提供了一个 JSF 的为基础的框架,所谓的页岩。
其他的 MVC 框架,并不是基于 J2EE 的包括 Ruby on Rails 的,WebObjects ,Django , ,Zend 公司,大展 ATK 公Catalyst, TurboGears , CakePHP , Symfony (对于
PHP ) 。
司,并 CodeIgnite(对于
PHP ) Struts4
php 是一个 Struts 框架的
PHP 的 web 脚本语言版本。
Girders 是微软.NET 基于 C #的 Struts 框架的一部分。
附录 2 Struts Apache Struts is an open-source web application framework for developing
Java EE webapplications. It uses and extends the Java Servlet API to encourage developers to adopt amodel-view-controller MVC architecture. It was originally created by Craig McClanahan anddonated to the Apache Foundation in May 2000. Formerly located under the Apache JakartaProject and known as Jakarta Struts it became a top level Apache project in 2005. Design goals and overview In a standard Java EE web application the client will typically submit information to theserver via a
web form. The information is then either handed over to a Java Servlet whichprocesses it interacts with a database and produces an HTML-formatted response or it is givento a JavaServer Pages JSP document which intermingles
HTML and Java code to achieve thesame result. Both approaches are often considered inadequate for large projects because they mixapplication logic with presentation and make maintenance difficult. The goal of Struts is to cleanly separate the model application logic that interacts with adatabase from the view HTML pages presented to the client and the controller instance thatpasses information between view and model. Struts provides the controller a servlet known asActionServlet and facilitates the writing of templates for the view or presentation layer typicallyin JSP but XML/XSLT and Velocity are also supported. The web application programmer isresponsible for writing the model code and for creating a central configuration filestruts-config.xml which binds together model view and controller. Requests from the client are sent to the controller in the form of “Actions” defined in theconfiguration file if the controller receives such a request it calls the corresponding Action classwhich interacts with the application specific model code. The model code returns an“ActionForward” a string telling the controller which output page to send to the client.Information is passed between model and view in the form of special JavaBeans. A powerfulcustom tag library allows it to read and write the content of these beans from the presentationlayer without the need for any embedded Java code. Struts also supports i18n internationalization provides facilities for the validation of datasubmitted by web forms and includes a template mechanism called “Tiles” which for instanceallows the presentation layer to be composed from independent header footer and contentcomponents. Competing MVC frameworks Although Struts is a well documented mature and popular framework for building front endsto Java applications it is facing new challenges from newer “light weight” MVC frameworkssuch as Spring MVC Stripes and Tapestry. The new XForms standards and frameworks may alsobe another option to building complex web Form validations with Struts in the future. The WebWork framework spun off from Apache Struts several years ago aiming to offerenhancements and refinements while retaining the same general architecture of the original Strutsframework. However it was announced in December 2005 that Struts would re-merge withWebWork. WebWork 2.2 has been adopted as Apache Struts 2 which reached its first full releasein February 2007. Sun recently brought out a new addition to the Java platform called JavaServer Faces JSF.Aside from the original framework the Apache Struts project also offers a JSF-based frameworkcalled Shale.Other MVC frameworks that are not J2EE based include Ruby on Rails WebObjects DjangoCatalyst TurboGears CakePHP Symfony for
PHP Zend Achievo ATK and CodeIgniter forPHP. Struts4
php is a version of the Struts framework for the
PHP web scripting language.Girders is a port of the Struts framework in C for Microsoft .
NET.