Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Blank Archetype (struts2-archetype-blank)

NearlyMinimal-yet-minimal complete Struts 2 application, includes only an example package/action and some minimal tests.

Features

  • XML-based configuration, demonstrates including additional config file
  • Example actions
  • Resource Package-level resource bundle
  • XML-based validation
  • Unit-testing

The Starter Archetype (struts2-archetype-starter) (warning) Not yet updated for 2.1.6

The Starter archetype creates a more featured application using several common technologies used in production applications.

...

  • Sitemesh integration
  • Action example (instantiated both instantiated through Spring and Struts itself)
  • Spring integration
  • Validation example (action and action-alias level)
  • Conversion example (global and action level)
  • Resource bundle (both global, action and package level)

The Portlet Blank Archetype (struts2-archetype-portlet) (warning) Not yet updated for 2.1.6

The Portlet blank archetype creates a minimally populated JSR 168 portlet.

...

  • View, Edit, and Help mode examples
  • Simple form for preferences in Edit mode
  • Can be deployed as a servlet or portlet application
  • Can use Maven Jetty plugin to deploy as a servlet webapp

The Portlet Database Archetype (struts2-archetype-dbportlet) (warning) Not yet updated for 2.1.6

The Portlet database archetype creates a simple JSR 168 portlet that displays the contents of a database table.

...

  • Uses Spring and Hsql to show a real database query
  • Builtin caching of query results
  • View, Edit, and Help mode examples
  • Simple form for preferences in Edit mode
  • Can be deployed as a servlet or portlet application
  • Can use Maven Jetty plugin to deploy as a servlet webapp

Creating an Application Using

...

a Maven Archetype

From a working directory for your project, run the following command: Run the following command from your project's parent directory (the project will be created in a sub-directory).

Code Block
mvn archetype:generate -DgroupId=tutorial \
                       -DartifactId=tutorial \
                       -DarchetypeGroupId=org.apache.struts \
                       -DarchetypeArtifactId=struts2-archetype-blank \
                       -DarchetypeVersion=2.1.6

...

Parameter

Description

groupId

The id for the group the application belongs to. Usually is the root package for applications in your company, e.g. com.mycompany

artifactId

The id for the project. The project will be created a sub-directory named after this parameter.

archetypeGroupId

The group id of the archetype. Will always be org.apache.struts for Struts archetypes

archetypeArtifactId

The id of the archetype

archetypeVersion

The version of the archetype

package

(Optional) The base Java package to use for generated source code. Defaults to archetypeGroupId if not specified.

remoteRepositories

(Optional) A list of remote repositories that contain the archetype. If deployed to the standard Maven repository or locally, this is optional

...

.

...

Command Quick Reference

These commands are used from the directory created by the archetype plugin (the project's sub-directory that was created in the previous step).

  • To build
Code Block
   mvn install

...