This chapter demonstrates integration of Guice 3 with Struts 2. It is an action oriented, web framework based on MVC architecture. Guice integrates easily to provide dependency injection facility into the application developed. We will discuss the special modules and classes, which accomplish the task of integration. On top of it we would retrofit our application developed in the last chapter to be based on Struts 2. While doing so we will avoid writing servlets and filters and instead use Struts 2 provided classes.
It is desired that the reader is familiar with Struts 2, as primarily we are interested in injecting dependencies in Struts 2-based applications and not exploring Struts 2 itself. However, for the sake of completion of the subject matter, we will begin with a gentle introduction of the framework and go forward.