Home

This Chapter
-Chapter 22: How Struts Works
-The Action Servlet
-Creating A ModuleConfig Object
-The Request Processor
-Summary

Table of Contents
-Introduction
-Chapter 1: Model 2 and Struts
-Chapter 2: Input Validation with Action Forms
-Chapter 3: The HTML Tag Library
-Chapter 4: Input Validation and Data Conversion
-Chapter 5: The Validator Plugin
-Chapter 6: The Expression Language
-Chapter 7: JSTL
-Chapter 8: The Bean Tag Library
-Chapter 9: The Logic Tag Library
-Chapter 10: Struts-EL, Nested, selectLabel
-Chapter 11: Message Handling and Internationalization
-Chapter 12: The Tiles Framework
-Chapter 13: Securing Struts Applications
-Chapter 14: The Config Object
-Chapter 15: The Persistence Layer
-Chapter 16: Object Caching
-Chapter 17: File Upload and File Download
-Chapter 18: Paging and Sorting
-Chapter 19: Preventing Double Submits
-Chapter 20: Early HttpSession Invalidation
-Chapter 21: Decorating Request Objects
-Chapter 22: How Struts Works

Previous
Next

 

Chapter 22

How Struts Works

In the previous chapters you have learned how to design and develop Struts applications. This chapter will now conclude this book by exploring what is under the hood: the core classes that make Struts tick and how those classes integrate with each other to make up the most popular Model-View-Controller framework.

Understanding how Struts works will enable you to design and write more effective Struts applications too. For example, by knowing that Struts action objects are cached, you may not want to implement caching for those objects. By knowing what makes an instance of ActionForm reusable by Struts, you might want to design your action forms around this knowledge.

Since the Struts action servlet is the main component that handles every Struts action invocation, discussion of how Struts works should focus on the lifecycle methods of this servlet. The Struts action servlet acts as the controller in the Model-View-Controller pattern implemented by Struts. This class therefore plays a central role in the Struts framework. In addition, of particular importance is the ModuleConfig interface, which encapsulates application configuration, and the RequestProcessor class, which handles each HTTP request..

The structure of this chapter therefore is as follows. The first section of this chapter deals with the Struts action servlet, followed by the ModuleConfig interface, and concluded by a thorough discussion of the RequestProcessor class.

Note

This chapter is best read with the Struts 1.2 source code within reach, so that you can easily look up the piece of code being discussed. To save space this chapter avoids code that would otherwise take too much space..

Previous
Next