After reviewing the "Convention Plugin documentation" I found "struts" and 
"action" are
keywords for the plugin to find packages.

As the classes were under "org.apache.struts.struts2annotations.action", the 
default
Namespace didn´t find the action classes. I simply changed "struts" to "foo" 
and the
Project started to work --> org.apache.foo.struts2annotations.action

You can also check it looking into the default namespace in the Config Browser 
Plugin, where
There should appear 3 actions: hello, register and register-input.

As I am using JBoss, I also included two constants in struts.xml which are 
considered in the documentation.

Finally, I would like to thank Łukasz for his quick comments.

-----Mensaje original-----
De: Lukasz Lenart [mailto:lukaszlen...@apache.org]
Enviado el: jueves, 21 de marzo de 2013 14:34
Para: Struts Users Mailing List
Asunto: Re: Struts 2 Annotations Maven - No Action mapped

2013/3/21 Álvaro López López <allo...@gmv.com>:
> I have tried to mimic that behavior in my version (struts2 - 2.312) but what 
> explained in this paragraph is not working:
>
> "The input method above returns "input".
> By the standards of the Convention plugin, the view page rendered will be 
> register-input.jsp (from WEB-INF/content).
> On that view page is a Struts 2 form tag with an action attribute value of 
> register.
> When submitting the form, the execute method of class RegisterAction will be 
> run.
> Since the execute method returns success, the view page rendered is 
> register-success.jsp."
>
> I have changed the "action" parameters in JSP to register-success and 
> hello-success.
> Also, I have annotated the corresponding methods with 
> @Action("xxxxx-success") in the action classes.
>
> If you put any other string (e.g. hello-execute), it doesn´t work.
> It must be the same name as the WEB-INF/content/xxxx-yyyy.jsp you want to map.

Not it doesn't, action is action, result is result, don't mix them in @Action. 
See simple example:

public class RegisterAction extends ActionSupport {

   @Action("register") // basically not needed, just to show what I mean
   public String execute() {
       if (something)
            return "success";
       else
           return "input";
   }
}

and under WEB-INF/content/
- register-success.jsp (or just register.jsp)
- register-input.jsp

>
> After that, I get exceptions when assigning the personBean. For instance:
>
> "Error setting expression 'personBean.age' with value 
> '[Ljava.lang.String;@340556b3': ognl.OgnlException: target is null for 
> setProperty(null, "age", [Ljava.lang.String;@340556b3)"
>
> I also attached a "message" property to the HelloAction but it didn´t appear 
> in the page, so the execute() method wasn´t called!
>
> I´m afraid the Action classes are not being found.
> I have also changed the namespace from "struts2annotations" to
> "Struts2_Annotations_Mvn" (the name of the project) but it still
> doesn´t work... :S
>
> Next step?

Read documentation [1] how the Convention plugin is working, basically

[1] http://struts.apache.org/development/2.x/docs/convention-plugin.html


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


P Please consider the environment before printing this e-mail.

______________________
This message including any attachments may contain confidential 
information, according to our Information Security Management System,
 and intended solely for a specific individual to whom they are addressed.
 Any unauthorised copy, disclosure or distribution of this message
 is strictly forbidden. If you have received this transmission in error,
 please notify the sender immediately and delete it.

______________________
Este mensaje, y en su caso, cualquier fichero anexo al mismo,
 puede contener informacion clasificada por su emisor como confidencial
 en el marco de su Sistema de Gestion de Seguridad de la 
Informacion siendo para uso exclusivo del destinatario, quedando 
prohibida su divulgacion copia o distribucion a terceros sin la 
autorizacion expresa del remitente. Si Vd. ha recibido este mensaje 
 erroneamente, se ruega lo notifique al remitente y proceda a su borrado. 
Gracias por su colaboracion.

______________________

Reply via email to