This chapter concludes the section on web application development. We focus on the integration of Struts in Spring web applications. To follow the examples in this chapter, you need the Struts libraries, which you can obtain from http://struts.apache.org/.
Whether you decide to use Struts or Spring MVC in the web layer of your application greatly depends on the amount of code you have already implemented. If you are starting the implementation from scratch, we recommend that you use Spring MVC because it represents cleaner implementations of the MVC architecture.
In this chapter, we specifically focus on the following aspects of using Struts in a Spring web application:
Introducing Struts: Even though we do not mean for this text to be a complete description of Struts, we do explore the Struts architecture and explain how it integrates with the MVC architecture; we also provide a simple Struts application.
Accessing Spring beans: If you find that you need to use Spring in your Struts application, refer to this section. Here we show you how to gain access to the Spring application context and how to retrieve beans from the context programmatically in Struts actions.
Using other views: If you are writing a hybrid application, you may be surprised to find out that the views you configured in your Spring application context are not available to the Struts framework. In this section, we show you how to configure Struts to use other view technologies and we discuss the implications of doing so.
Struts actions as Spring beans: This section explains how to configure Struts actions as regular Spring beans; doing so allows you to take advantage of the full feature set of the Spring framework.
Combining Struts and Spring MVC: The last section explores how to integrate and connect the Struts actions and Spring MVC controllers so that you can take advantage of Spring views and other features accessible only to Spring MVC controllers.