Struts Module

Apache Struts is the most established MVC (model view controller) framework in the splintered world of Java webapp client technologies. JavaGen's Struts module generates

  • ActionForm beans
  • JSP forms matching the ActionForm properties
  • A validation.xml file based on the datatypes in the used in the forms
  • A ApplicationResources.properties i18n (internationalization) file
  • Action beans that handle basic CRUD and list navigation code - not supported
  • Minimal session beans to support clint state - not supported

The most important stereotype is <<struts-form>> which generates an ActionForm, a JSP form, validation and resource files. Generating these artifacts is very strait forward as this example demonstrates:

struts form example

This module is useful for boot-strapping Struts projects but some hand-coding is usually required. Refer the web module from the JavaGen Petstore as a working example.

Note: The Struts module is due for a refactoring (it was written in 2003) and two of its sub-modules are no longer supported.

JavaGen Stereotypes

StereotypeUML ElementDescription
<<struts-form>> Class Generates: ActionForm, JSP form, validation.xml and ApplicationResources.properties files. See struts-form

JavaGen Ant Properties

Set these properties in your build.xml or props-javagen.xml file. Note that the javagen.struts.flag property turns the Struts module on and the remaining switches fine-tune Struts generation by turning sub-modules off:

PropertyDefaultDescription
javagen.struts.flagfalseSwitch that turns on struts module, set to true to activate.
javagen.struts.no-action.flagtrueSwitch that turns off Struts Action class generation, set to false to de-activate.
javagen.struts.no-form.flagtrueSwitch that turns off Struts ActionForm class generation, set to false to de-activate.
javagen.struts.no-session.flagtrueSwitch that turns off Struts session bean generation, set to false to de-activate.