Struts 1.x

Akrogen provide catalog sample to generate basic components of Struts1.x framework.

This catalog contains :

Before using this catalog, it is adwiced to learn to use Akrogen.

Catalog installation

After having installed Akrogen vous must download struts1.x-catalog catalog.

Unzip distribution and refer this catalogue into your Eclipse project to use it.

Catalog utilisation

Akrogen can generate components with Wizard or Composant by using catalog view. Once you have referenced Struts1.x catalog, view catalog must display Struts1.x Components et Wizards :

Wizard Struts1

Struts1 Wizard is enable to call components (one after the other) ActionForm, form-bean, Action and action-mapping into the same Eclipse wizard. This section will use Struts1 Wizard to generate the whole Struts1.x component/

Model selection

form-bean and action-mapping XML components are able to update struts-config.xml XML file. Access of those components require the selection of struts-config XML file to update. On another words, those component define model type of xml and strutsConfig key.

ApplicationResources XML component is able to update ApplicationResources.properties file properties. On another words this component define model type of properties and applicationResources key.

So, before opening Struts1 Wizard, you must select struts-config XML file to update.

To do that you must select "model selection" mode (by clicking on the little icon which represent a datagrid, on the top of catalog view.

Select therefore struts-config.xml XML file to update into standard Eclipse view (Navigation, Package Explorer,..). You have a sample of XML struts-config into Data directory of the catalog.

After selecting struts-config file, datagrid which display waited models by components is updated with your selected strut-config file :

Select ApplicationResources.properties file.

Model & Path

struts-config.xml and ApplicationResources fiel selection can be borring. It's possible to set files to use into XML components, in order to avoiding sekect files when you access Struts1 wizard or XML components.

To configurate that, you must update XML components to set path to use for strutsConfig and applicationResources models. To avoid select :

  • struts-config.xml file, add path attribute into model with strutsConfig key of form-bean and action-mapping XML components of catalog. path attribute must be setted with location of your struts-config.xml file :
      <model key="strutsConfig" type="xml" useIntoInput="true" omitDocumentType="true" 
             path="web/WEB-INF/struts-config.xml" />

    In this example, web/WEB-INF/struts-config.xml file of your Eclipse project will be used.

  • ApplicationResources.properties file, add path attribute into model with applicationResources key of ApplicationResources XML components of catalog. path attribute must be setted with location of your ApplicationResources.properties file :
      <model key="applicationResources" type="xml" useIntoInput="true" omitDocumentType="true" 
             path="src/net/sourceforge/gestcv/ApplicationResources.properties" />

    In this example, src/net/sourceforge/gestcv/ApplicationResources.properties file of your Eclipse project will be used.

You can define path which refer file which is not into your Eclipse project. You can use patterns /*/ (any folder) et /**/ (any list of folder) in your path.

For example, you can fill path like this :

  path="web/*/struts-config.xml" 

For more information, you can go at Path section.

Struts1.x settings

Selection of packages into components ActionForm, Action can be boring. it's possible to have persistentt value for pakages. Package values are stored into Resources/struts1.x-settings.properties properties file of the catalog. With XML component StrutsSettings you can manage values of package :

Start Struts1 wizard

To start components generation, double click on Struts1 Wizard. ActionForm Wizard will open.

Once you have filled all the wizard page, click on Finish button to launch generation code.