The Bootstap tutorials starts from the very beginning and steps through creating a simple application.

Ready, Set, Go!

We download the framework and get started on an application of our own.

Hello World

We present a page with a simple Welcome message.

Using Tags

We create a Welcome page with links to other actions in the application.

Coding Actions

We interpret the Logon form, and return a different result code depending on the circumstances.

Selecting Results

We setup different results for different result codes.

Validating Input

We use the validation framework to verify data submitted from a form.

Localizing Output

We move the validation messages to a message resource bundle.

Flying Solo

And, now, you're on your own, but not alone ...

(lightbulb) For more coding examples, see the Cookbook.

Next: Ready, Set, Go!

  • No labels

4 Comments

  1. TODO

    • A validation lesson that plugs into the rest of the tutorial.
    • Lessons 7-9
    • Review "The Attic" tutorial and bring forward any interesting bits.
    • After the initial pass on the wiki, I'd like to come back and setup a tutorial application to go with the code.
  2. I am setting up a struts2 app for the first time and I followed the bootstrap app docs to get myself going.

    I had a few minor problems due to some bad assumptions I made. They will no doubt seem facile to experts but certainly weren't obvious to me.

    I didn't find solutions to those issues here and ended up searching the web.

    I thought I'd post the info here in case someone who's able to wants to update this.

    • the struts.xml is deployed to WEB-INF/classes - it wont be found in WEB-INF/ (and I had already created my project when I saw that I could have done it with the struts2 maven project archetype)
    • the com.opensymphony.xwork2 package is actually part of the struts release
    • the HttpRequest object and other classes in the Servlet API can be accessed via static methods on org.apache.struts2.ServletActionContext
  3. Ready, Set, Go! page suggests to use the following maven command to create new application:

    mvn archetype:create -DgroupId=be.realdolmen.struts2 -DartifactId=tutorial
    \ -DarchetypeGroupId=org.apache.struts
    \ -DarchetypeArtifactId=struts2-archetype-starter
    \ -DarchetypeVersion=2.0.11.2

    Yet this does not create a blank application but "a more featured application using several common technologies used in production applications" (see http://struts.apache.org/2.x/docs/struts-maven-archetypes.html).

    1. Using the blank application would be the recommended way to create a blank application; the archetype creates a new application, not a blank one, with some common technologies included. We're always happy to get new, maintained archetypes--feel free to file a JIRA with a patch!

      Thanks,
      Dave