| This Chapter | |
| - | Chapter 22: How Struts Works |
| - | The Action Servlet |
| - | Creating A ModuleConfig Object |
| - | The Request Processor |
| - | Summary |
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..