Struts represents the state of the application with special classes called ActionForm beans. The ActionForm base class is an abstract class that you must subclass to use in your process (represented in Struts by an Action class). Instances of the ActionForm subclasses are automatically created when the controller servlet is fulfilling a request. The predefined validate method is used to allow a process's data entry to proceed. To reference the ActionForm subclasses that you defined inside the web application's JSPs and processes, you use form-bean elements on the configuration file.
Each form-bean element defines an ActionForm subclass used by the application. It has two attributes:
nameName by which this form bean will be referenced in the configuration file
typeThe full Java class name for this bean
Listing 2 presents a fragment of a form-beans element for the ArticleDB application.
Listing 2 - Defining the Form Beans Used in ArticleDB
<form-beans> <!-- EditArticle form bean --> <form-bean name="editArticleForm" type="jspbook.example.EditArticleForm" /> <!-- EditJournal form bean --> <form-bean name="editJournalForm" type="jspbook.example.EditJournalForm" /> <!-- Edit Author form bean --> <form-bean name="editAuthorForm" type="jspbook.example.EditAuthorForm" /> </form-beans>