Developing Struts appswith Eclipse

In this chapter we're going to take a look at using Eclipse to write Struts-based web apps. This is going to give us experience not only using Struts, but also creating large-scale web apps, including handling build dependencies (where one file needs to be built before another), avoiding deleting files in the output folders when doing a full build (deleting all files in the output folder is called "scrubbing," which Eclipse does by default—and scrubbing a Struts app would delete needed files), organizing your source code files into a folder after the project has already been created, and other issues. We're also going to take a look at a popular Struts plug-in, Easy Struts, to help create Struts apps in Eclipse. Although we're going to discuss Struts in overview here, we'll assume that if you want to follow the programming in detail, you already have some experience with Struts—in this tutorial, our focus is on Eclipse, not Struts. Struts is built on Model-View-Controller (MVC) architecture that has become popular in servlet/JSP programming. The original servlet/JSP programming architecture (sometimes called Model 1) was somewhat ad-hoc, using servlets, JSPs, and beans in a way that was completely up to the programmer. Since that time, web apps have become more large-scale, and the MVC architecture (sometimes called Model 2) has been adopted. In MVC programming, the view (often a JSP) handles the visual interface with the user, the model (often a JavaBean) handles the internal logic of the app, and the controller (often a servlet) handles the overall communication between the view and the model as well as forwarding user reqests as needed to other code. In Struts terminology, the view is constructed using forms and the controller with actions. The model is often implemented with form beans.