You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

The Struts 2 Blank Archetype ("blank-archetype") provides a minimal, but complete, Struts 2 application. It demonstrates some of the most basic Struts 2 concepts, including:

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

Creating Our blank-archetype Project

We'll run the following command from our project's parent directory (this is shown using Unix-style commands).

$ mvn archetype:generate -B \
                         -DgroupId=tutorial \
                         -DartifactId=tutorial \
                         -DarchetypeGroupId=org.apache.struts \
                         -DarchetypeArtifactId=struts2-archetype-blank \
                         -DarchetypeVersion=2.1.6
$ ls
tutorial/
$ cd tutorial
$ ls
pom.xml         src/

Project Structure

The source code structure follows the normal Maven directory structure. Blank-archetype does not include all of these directories. Our project's structure looks like this:

src
|-main
|---java
|-----tutorial
|-------example
|---resources
|-----tutorial
|-------example
|---webapp
|-----WEB-INF
|-----example
|-test
|---java
|-----tutorial
`-------example

  • No labels