Home > Articles > Programming > Java

  • Print
  • + Share This
From the author of

Form-Bean Elements

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:

  • name—Name by which this form bean will be referenced in the configuration file

  • type—The 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


<!-- EditArticle form bean -->

<!-- EditJournal form bean -->

<!-- Edit Author form bean -->

  • + Share This
  • 🔖 Save To Your Account