Basic Components of Struts


Enter Struts

Although the Model-View-Controller architecture is a powerful means of organizing code, developing such code can be a painstaking process. This is where Struts comes in. Struts is a Web application framework that streamlines the building of Web applications based on the MVC design principles. But what does that mean? Is Struts an MVC Web application that you just add on to or extend? Is Struts just some libraries? Actually, Struts is a little bit of both. Struts provides the foundation, or framework, for building an MVC-oriented application along with libraries and utilities for making MVC development faster and easier.

You could create a new Controller servlet every time you wanted to use the MVC design pattern in your Web application. Additionally, you'd need to create the management/flow logic for getting data to and from the Model and then routing requests to the View. You'd also need to define interfaces for interacting with your Model objects and all the utility code that goes along with using the MVC design pattern. However, instead of going through this process each time you create a new application, you can use Struts. Struts provides the basic structure and outline for building that application, freeing you to concentrate on building the business logic in the application and not the "plumbing."

To better understand the benefits of Struts, consider the following analogy. If you were to create a GUI application in Java, you wouldn't write a text field widget and a drop-down widget yourself. You would use Java's Swing API that already has standardized, fully functional code that provides these controls. Not only are the Swing controls ready-to-use, but they are also understood by all Java programmers. Struts provides the same type of advantages: Struts supplies a standard way of implementing an MVC application, the Struts code is tried and true, and the techniques required to use Struts are well known and documented.

In addition to providing the foundation for MVC applications, Struts provides rich extension points so that your application can be customized as you see fit. This extensibility has led to several third-party extensions being made available for Struts, such as libraries for handling application workflow, libraries for working with view technologies other than JSP, and so on. There is a brief overview of many of these popular third-party Struts extensions in Appendix B.

The Evolution of Struts

Struts was originally created by Craig R. McClanahan and then donated to the Jakarta project of the Apache Software Foundation (ASF) in May 2000. In June 2001, Struts 1.0 was released. Since then, many people have contributed both source code and documentation to the project and Struts has become the de facto standard for building Web applications in Java and has been embraced throughout the Java community. Struts 1.1 was released in June 2003 and included a substantial amount of new functionality, including the addition of Tiles, Validator, declarative exception handling, and much more. Later, in December 2004, Struts 1.2 was released with several minor updates to the framework. Struts 1.3, released in 2006, introduced the largest change to the framework since the 1.1 release: the move to a chain of responsibility (COR)-based request processing engine. The latest release of Struts at the time of this writing is 1.3.5, and that is the release covered in this book.

Today, Struts is continuing to evolve. There are now two distinct major versions of Struts: Struts 1 and Struts 2. Struts 1 is the mature, widely adopted, documented, and supported version of Struts. It is the version of Struts in use now and it is the version of Struts discussed in this book. Struts 2 is a completely new version of Struts based on the merger of Struts and WebWork, another popular open source Java Web application framework. At the time of this writing, Struts 2 is under development and does not have a specific release date. For this reason, Struts 2 is not discussed further in this book. Going forward, Struts 1 and Struts 2 will both be actively developed and maintained as separate subprojects of the Struts project.

Another event has punctuated Struts' evolution: its graduation to a top-level Apache project. Struts is no longer a subproject of the Jakarta Project. This is an important change because it affords Struts more autonomy and gives it the ability to have its own subprojects.

Struts Is Open Source

When Craig McClanahan donated Struts to the Apache Jakarta project, it became open source software. This means that anyone can download the source for Struts and modify that code as he or she sees fit. Of course, such changes affect only that developer. The standard code provided by ASF remains unaltered.

Over time, additional developers were added to the Struts project and were authorized to make changes to the code. These people are known as committers, since they have commit access to the source control repository for Struts. A limited number of people have this access, and each picks an area of interest and works on that part of the project that he or she is interested in.

A key advantage of open source is that it enables rapid development and maintenance cycles. For example, in an open source project, bugs can be fixed in a timely fashion. For ASF projects, bugs are handled by the committers, but anyone can fix a bug and provide a patch that the committers will then evaluate and "commit" if they deem it appropriate. Furthermore, anyone can contribute code to a project that incorporates changes and/or enhancements. Such submissions are also evaluated by the committers. In the case of Struts, contributions from members of the Struts community have played a significant role in the evolution of the project over the years.

Support for Struts comes in three forms. First is the API and usage documentation that comes with Struts. Second, Struts has a very active mailing list where you can get support for virtually any question. Third, several third-party consulting companies specialize in Struts support and development. Being open source, Struts is completely free of charge and allows you to make changes to it without any consequence so long as you abide by and preserve the ASF license.

Note 

Information for signing up to be a member of the Struts users mailing list can be found on the Struts Web site at http://struts.apache.org/.



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