Enter Struts

 < Day Day Up > 

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 textfield widget and a dropdown 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 add-ons being made available for Struts, such as libraries for handling application workflow, libraries for working with view technologies other than JSP, and so on.

Struts Is Open Source

Struts was originally created by Craig R. McClanahan and then donated to the Jakarta project of the Apache Software Foundation (ASF) in 2000. In June of 2001, Struts 1.0 was released. Since then, many people have contributed both source code and documentation to the project and Struts has flourished. Today, Struts has become the de facto standard for building Web applications in Java and has been embraced throughout the Java community. As of the writing of this book, the current version of Struts is 1.2, and Struts is continuing to evolve.

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.

Slowly, 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. Only ten or so people have this access, and each picks an area of interest and works on that part of the code that he or she is interested in.

One of the advantages of open source software is that 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. Thus, open source enables rapid development and maintenance cycles. 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.

Support for Struts comes in three forms. First is the API 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.

 < Day Day Up > 

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

Similar book on Amazon

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