Struts 2

Struts 2.0.6 (the first general availability release) has been out a month (but I’ve only just noticed). I’ve tried a HelloWorld app and after some difficulties got it running.

The difficulties were all my own fault – I kept getting the following messages: “There is no Action mapped for action name HelloWorld.” or “There is no Action mapped for namespace / and action name HelloWorld.”. They were resolved when I realised my struts.xml was in the wrong folder – by default this should be in the root of classes and I had it in the root of WEB-INF.

This entry was posted in Uncategorized. Bookmark the permalink.

6 Responses to Struts 2

  1. GaZ says:

    Yarr! Struts2 be a thing of much beauty (compared to the sea-hag that is our Struts usage at work ;) )

    Did you try using the maven archetype when getting the helloworld example running? Tiz a good example of how much easier Maven can make things :)

    See http://struts.apache.org/2.x/docs/ready-set-go.html

  2. Boz says:

    Agreed Struts 2 looks a lot better than the “interesting” variant we use.

    I couldn’t get the maven integration working right in netbeans – I guess I need to load struts 2 into the maven repository, I guess that ought to be my next step.

  3. GaZ says:

    ? Hmm… it should download the struts2 libraries when you create the project from the archetype, using their custom repo (http://people.apache.org/repo/m2-snapshot-repository)

    But yeah, the Netbeans plugin for Maven did seem a bit strange when I tried it. Try the following (assuming you’ve installed Maven and it’s in your PATH):

    1. Create the project: mvn archetype:create -DgroupId=tutorial -DartifactId=tutorial -DarchetypeGroupId=org.apache.struts -DarchetypeArtifactId=struts2-archetype-starter -DarchetypeVersion=2.0.5-SNAPSHOT -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository

    2. Change to the newly-created “tutorial” directory and type: mvn netbeans-freeform:generate-netbeans-project (from http://maven.apache.org/guides/mini/guide-ide-netbeans/guide-ide-netbeans.html)
    This should create a directory for the netbeans project file and all that “extra stuff” netbeans uses.
    Or, if you have an evaluation copy of IntelliJ, try “mvn idea:idea” :)

    All the dependent libraries (i.e. struts2, etc.) should be downloaded to your local repository when you create the netbeans project (well, they were when I created the IDEA ones)…

  4. GaZ says:

    ? think my previous comment was swallowed by spam filter…!

  5. Boz says:

    rescued it – akismet normally does a good job, although with most of the comments I get being spam :( it hasn’t had much non-spam to process.

    Hopefully, I’ll give the Maven stuff a whirl later.

  6. Pingback: ’Twas Brillig* » Blog Archive » Struts 2 with Maven