Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Struts2 Annotations

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to implement the Struts 2 Annotations in my project, but I don't know how.

I added the convention-plugin to my pom



I modified the web.xml like this:



But when I add the @Result annotation, the IDE tells me:




What I'm doing wrong?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using a "value" annotation parameter, of which there isn't one. Do you mean "location"?

See the Result annotation documentation.
 
Peter Mest
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:Using a "value" annotation parameter, of which there isn't one. Do you mean "location"?

See the Result annotation documentation.



The first time I tried with location and it didn't work and I saw "value" in a Struts 2 book (??) and I thought this is the reason why is not working.


Anw, I retried the same setup and doesn't work. When I press the link associated to the action helloWorld (I have a class HelloWorld which extends ActionSupport, its sends me to the exactly the same page. So, from index.jsp, it's sends to index.jsp.

I uploaded the project (a simple HelloWorld app) to FileFront, maybe someone sees where is the problem.
http://www.filefront.com/16364385/Hello_World.zip
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just post the code; how long can it be?!
 
Peter Mest
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok.

web.xml



index.jsp



HelloWorld.java



 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And what's the problem? That doesn't look like what you had posted originally.

Note that Action.SUCCESS is *not* "SUCCESS", but rather "success".
 
Peter Mest
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:And what's the problem? That doesn't look like what you had posted originally.

Note that Action.SUCCESS is *not* "SUCCESS", but rather "success".



Ok. I changed that. Anw, I don't see any difference for the moment. :)

I commented the package section from struts.xml and now I receive:
# Messages:
There is no Action mapped for namespace / and action name helloWorld.

So

If in my struts.xml I have this code:


I get the behaviour from the 3rd post.

So, from index.jsp, it's sends back to index.jsp. It should send me to HelloWorld.jsp



If I comment the package section I receive

There is no Action mapped for namespace / and action name helloWorld.
 
Peter Mest
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No more suggestions? :cry:
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Turn up the log level to DEBUG and check out how it's scanning: you'll find there are a couple of issues.

You can also use the config-browser to help track stuff like this down--it will tell you what S2 believes your configuration to be (including convention-based actions). Read the convention plugin documentation page very carefully, paying attention in particular to the parameters it provides, and their defaults. It is not always doing what I think you believe it is.

Also, be cautious about using package names that aren't yours.
 
Whatever you say buddy! And I believe this tiny ad too:
The trailboss has a kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic