Struts
Struts is perhaps the most widely known framework for building Web applications, using the JSP approach as a foundation and enhancing it with a powerful custom tag library that implements the concept and the advantages of a Model-View-Controller based architecture.
Struts is an open source framework that is part of the Jakarta project, which is sponsored by the Apache Software Foundation. Struts, like JavaServer Faces, is an attempt to apply the Model-View-Controller (MVC) architectural pattern to Web application development. The Struts framework includes several pieces which make up the controller component of its applications, such as a central servlet (the ActionServlet) and developer-defined request handlers.
Struts comes with a JSP UI tag library which supports the view component of its applications. The view of a Struts application may also make use of JSTL, XSLT, and Tiles, among other technologies. The application model is made up of Java beans, created by an application developer, which can make use of a variety of technologies, such as JDBC or EJBs.
Struts introduces the concept of actions, which are used as request handlers when a special URI is used for form submission. These actions are responsible for processing form data (beans), possibly creating new form beans, and redirecting to a new JSP page. These actions act as a developer-defined intermediary between the Struts ActionServlet and the application model.
![]()
In general, the Struts Framework has proven its performance and scalability. It is widely used and it also enforces the Model-View-Controller architecture, which is a big advantage compared to JSP-servlet based applications. Struts makes heavy use of JSP tag libraries, which results in a small performance overhead. This overhead can be reduced by using the dynamic caching framework of IBM WAS V6, which now includes support for the Struts framework, including tiles.
For design and performance reasons, the following guidelines are recommended:
- Choose JavaServer Pages instead of XSLT for rendering the view
If you decide to use the Struts framework, you should try to use JavaServer Pages instead of XSLT to generate the user interface, whenever possible, for performance reasons.
- Do not use form beans to transfer data to the business logic tier
Although it will generate a small performance overhead to copy the data into a custom created data transfer object, you should not use the view-helper class (form bean) to pass the data to the business logic. The use of form beans for this purpose creates a dependency on the Struts framework that you do not want to force into the Business Process layer. Therefore, try not to use form beans for data transfer to provide a clean separation between the layers and to avoid data conversion at the business logic layer. You might also want to use reflection to copy the data between the two objects.
- Use servlet/controller best practices to implement action handlers
Actions are multi-threaded like servlets. They communicate with the model, invoke business logic, and return the model objects to the view. Finally, they perform tasks very much like controller servlets. Therefore, follow all of the best practices associated with servlets (Control).
See also..