The Development Process with Struts

Prefatory to creating a Struts application, you must do three basic things. First, determine what views will be displayed, especially the forms in the application, the data they will collect, and the actions that will be linked to the data collected. Second, record those decisions in an XML configuration file for the Struts controller (struts-config.xml), representing the forms and actions. Third, write the classes representing the forms and actions. It is crucial to note that different developers may tackle these tasks in a different order. If you are working from existing requirements, you would likely move straight to the XML configuration file. If application flow and data may be defined piecemeal, you might start working on some form and action classes and integrate them gradually into your configuration file. If you are a new Struts developer, you will likely find that you are constantly moving back and forth between the configuration file, your views, and your Java code; you will also find that, while reading this chapter, you will need to move back and forth between the section discussing the Struts configuration file and the other aspects of a Struts project. This tension between what belongs in the configuration file and what belongs in the other resources has motivated a number of Struts tools such as IDE plug-ins, XDoclet templates, and so forth; but, as with many frameworks, until you have experienced the pain, you won’t obtain much ...

Get Java Enterprise in a Nutshell, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.