Hey,
there are millions of threads that treat the action mapping issue, but none gives me the information I need.
Working through the Manning Struts2InAction book, I have set up the HelloWorld program using the XML configuration mode.
Now with annotations it gets me stuck. First, the book works with
Struts 2.0.x, the Result annotation has been moved to another jar and also follows another syntax.
When I used the jars the book uses too, the book example does what it's supposed to.
Now, using the latest struts version, the annotation arguments have changed. There is no value element anymore to trigger the view. I guess it has simply been replaced by the location attribute.
The more confusing part is that the name attribute is now mandatory. What about pass-through actions. The way I implemented it right now was by giving the annotation a name of SUCCESS, and make the execute() function return "SUCCESS".
The
java file is called manning.chapterTwo.AnnotatedNameCollector. This is the full class code.
The web.xml contains the 'actionPackages' init param for the FilterDispatcher with value 'manning', the struts.xml contains nothing but the devMode=true constant.
now, upon navigating to
http://localhost:8080/Struts2InAction/chapterTwo/annotatedNameCollector.action it gives me this ...
I don't know what they changed with the latest version of Struts2, but I'm stuck.