Acquiring Struts


Basic Components of Struts

The Struts framework is a rich collection of Java libraries and can be broken down into the following major pieces:

  • Base framework

  • JSP tag libraries

  • Tiles plugin

  • Validator plugin

A brief description of each follows.

Note 

In addition to the core pieces of the framework, the Struts project has an area known as the "Sandbox" where new code and ideas can be vetted. Code from the Sandbox is not packaged with Struts distributions but is available for download from the Sandbox section of the Struts Web site.

Base Framework

The base framework provides the core MVC functionality and consists of the building blocks for your application. At the foundation of the base framework is the Controller servlet: ActionServlet. The rest of the base framework is composed of base classes that your application will extend and several utility classes. Most prominent among the base classes are the Action and ActionForm classes. These two classes are used extensively in all Struts applications. Action classes are used by ActionServlet to process specific requests. ActionForm classes are used to capture data from HTML forms and to be a conduit of data back to the View layer for page generation.

JSP Tag Libraries

Struts comes packaged with several JSP tag libraries for assisting with programming the View logic in JSPs. JSP tag libraries enable JSP authors to use HTML-like tags to represent functionality that is defined by a Java class.

Following is a listing of the libraries and their purpose:

  • HTML  Used to generate HTML forms that interact with the Struts APIs.

  • Bean  Used to work with Java bean objects in JSPs, such as accessing bean values.

  • Logic  Used to cleanly implement simple conditional logic in JSPs.

  • Nested  Used to simplify access to arbitrary levels of nested objects from the HTML, Bean, and Logic tags.

Tiles Plugin

Struts comes packaged with the Tiles framework. Tiles is a rich JSP templating framework that facilitates the reuse of presentation (HTML) code. With Tiles, JSP pages can be broken up into individual "tiles" or pieces and then glued together to create one cohesive page. Similar to the design principles that the core Struts framework is built on, Tiles provides excellent reuse of View code. As of Struts 1.1, Tiles is part of and packaged with the core Struts download. Prior to Struts 1.1, Tiles was a third-party extension but has since been contributed to the Struts project and is now more tightly integrated. Tiles has been well adopted in the Java Web development community and is being used outside of Struts with other Java Web frameworks. Because of this popularity, at the time of this writing an effort is underway to separate Tiles into its own project. This will allow Tiles to continue to evolve independently of Struts. Of course, Struts will still have seamless integration with Tiles.

Validator Plugin

Struts comes packaged, as of version 1.1, with the Jakarta Commons Validator framework for performing data validation. Validator provides a rich framework for performing data validation on both the server side and the client side (browser). Each validation is configured in an outside XML file so that validations can easily be added to and removed from an application declaratively versus being hard-coded into the application. Similar to Tiles, prior to Struts 1.1, Validator was a third-party extension, but it has since been included in the project and is more tightly integrated.



Struts. The Complete Reference
Struts: The Complete Reference, 2nd Edition
ISBN: 0072263865
EAN: 2147483647
Year: 2004
Pages: 165
Authors: James Holmes

Similar book on Amazon
Struts 2 in Action
Struts 2 in Action
Murach's Java Servlets and JSP, 2nd Edition
Murach's Java Servlets and JSP, 2nd Edition
Jakarta Struts For Dummies
Jakarta Struts For Dummies
Head First Servlets and JSP: Passing the Sun Certified Web Component Developer Exam
Head First Servlets and JSP: Passing the Sun Certified Web Component Developer Exam

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net