Apache Struts 1 is an
open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
web application framework for developing
Java EE web applications. It uses and extends the
Java Servlet API to encourage developers to adopt a
model–view–controller
Model–view–controller (MVC) is a software architectural pattern commonly used for developing user interfaces that divide the related program logic into three interconnected elements. This is done to separate internal representations of infor ...
(MVC) architecture. It was originally created by
Craig McClanahan and donated to the
Apache Foundation
The Apache Software Foundation (ASF) is an American nonprofit corporation (classified as a 501(c)(3) organization in the United States) to support a number of open source software projects. The ASF was formed from a group of developers of the ...
in May 2000. Formerly located under the Apache
Jakarta Project
The Jakarta Project created and maintained open source software for the Java platform. It operated as an umbrella project under the auspices of the Apache Software Foundation, and all Jakarta products are released under the Apache License. As ...
and known as Jakarta Struts, it became a top-level Apache project in 2005.
The WebWork framework spun off from Apache Struts aiming to offer enhancements and refinements while retaining the same general architecture of the original Struts framework. However, it was announced in December 2005 that Struts would re-merge with WebWork. WebWork 2.2 has been adopted as
Apache Struts 2, which reached its first full release in February 2007.
Design goals and overview
In a standard
Java EE web application, the client will typically call to the server via a
web form
A webform, web form or HTML form on a web page allows a user to enter data that is sent to a server for processing. Forms can resemble paper or database forms because web users fill out the forms using checkboxes, radio buttons, or text fields. F ...
. The information is then either handed over to a
Java Servlet which interacts with a database and produces an
HTML-formatted response, or it is given to a
JavaServer Pages (JSP) document that intermingles HTML and Java code to achieve the same result.
Both approaches are often considered inadequate for large projects because they mix application logic with presentation and make maintenance difficult.
The goal of Struts is to separate the ''model'' (application logic that interacts with a database) from the ''view'' (HTML pages presented to the client) and the ''controller'' (instance that passes information between view and model). Struts provides the controller (a servlet known as
ActionServlet
) and facilitates the writing of templates for the view or presentation layer (typically in JSP, but
XML/
XSLT
XSLT (Extensible Stylesheet Language Transformations) is a language originally designed for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text or XSL Formatting Objects, which may subseque ...
and
Velocity are also supported). The web application programmer is responsible for writing the model code, and for creating a central configuration file
struts-config.xml
that binds together model, view, and controller.
Requests from the client are sent to the controller in the form of "Actions" defined in the configuration file; if the controller receives such a request it calls the corresponding Action class that interacts with the application-specific model code. The model code returns an "ActionForward", a string telling the controller what output page to send to the client. Information is passed between model and view in the form of special
JavaBeans
In computing based on the Java Platform, JavaBeans is a technology developed by Sun Microsystems and released in 1996, as part of JDK 1.1.
The 'beans' of JavaBeans are classes that encapsulate one or more objects into a single standardized objec ...
. A powerful custom tag library allows it from the presentation layer to read and write the content of these beans without the need for any embedded Java code.
Struts is categorized as a
Model 2 request-based web application framework.
Struts also supports
internationalization by web forms, and includes a template mechanism called "Tiles" that (for instance) allows the presentation layer to be composed from independent header, footer, menu navigation and content components.
See also
*
Comparison of web frameworks Two comparisons of web frameworks are available:
* Comparison of JavaScript-based web frameworks (front-end)
* Comparison of server-side web frameworks
This is a comparison of notable web frameworks, software used to build and deploy web applicat ...
References
Bibliography
*
James Holmes:
Struts: The Complete Reference, McGraw-Hill Osborne Media,
* Bill Dudney and Jonathan Lehr:
Jakarta Pitfalls, Wiley,
*
Bill Siggelkow
Bill(s) may refer to:
Common meanings
* Banknote, paper cash (especially in the United States)
* Bill (law), a proposed law put before a legislature
* Invoice, commercial document issued by a seller to a buyer
* Bill, a bird or animal's beak
Plac ...
:
Jakarta Struts Cookbook, O'Reilly,
*
James Goodwill
James is a common English language surname and given name:
*James (name), the typically masculine first name James
* James (surname), various people with the last name James
James or James City may also refer to:
People
* King James (disambiguat ...
,
Richard Hightower
Richard Hightower (born September 15, 1980) is an American football coach currently serving as special teams coordinator of the Chicago Bears of the National Football League (NFL).
Coaching career
Hightower was hired by the San Francisco 49ers o ...
:
Professional Jakarta Struts,
Wrox Press
Wrox Press (established in 1992) is a computer book publisher, originally based in Birmingham, England. Wrox uses a "programmer to programmer" approach, as all books published by Wrox are written by software developers. The original books were eas ...
,
* John Carnell and
Rob Harrop
Rob or ROB may refer to:
Places
* Rob, Velike Lašče, a settlement in Slovenia
* Roberts International Airport (IATA code ROB), in Monrovia, Liberia
People
* Rob (given name), a given name or nickname, e.g., for Robert(o), Robin/Robyn
* Rob (s ...
:
Pro Jakarta Struts, Second Edition, Apress,
* John Carnell,
Jeff Linwood and
Maciej Zawadzki:
Professional Struts Applications: Building Web Sites with Struts, ObjectRelationalBridge, Lucene, and Velocity, Apress,
*
Ted Husted, etc.:
Struts in Action, Manning Publications Company,
Struts View Assembly and Validation (PDF format).
* Stephan Wiesner:
Learning Jakarta Struts 1.2, Packt Publishing, 2005
External links
*
{{Apache Software Foundation
Struts 1
Cross-platform free software
Free software programmed in Java (programming language)
Java enterprise platform
Web frameworks
Software using the Apache license
2000 software