struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Álvaro López López <allo...@gmv.com>
Subject RE: Struts 2 Annotations Maven - No Action mapped
Date Thu, 21 Mar 2013 13:00:04 GMT
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.

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?


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

2013/3/21 Álvaro López López <allopez@gmv.com>:
> Hello everyone,
>
> I am following the Struts2 Getting Started tutorial at
> http://struts.apache.org/development/2.x/docs/getting-started.html
> I reached the "Struts 2 Annotations". I downloaded the Maven version:
> Struts2_Annotations_Mvn_2_2_1.zip Then, I updated the pom.xml file to get the latest
packaged compiled and ran the WAR under a JBoss AS 7.1 (struts2 version 2.3.12).
>
> However, it seems it doesn´t find the actions correctly.
> It just shows the register form (register-input.jsp) because it exists under WEB-INF/content:
>
> - Index.jsp:
>
> <p><a href="<s:url action='hello' />" >Get your hello.</a></p>
<p><a
> href="<s:url action='register-input' />" > Register for the
> drawing.</a></p>
>
> - For instance, for the 'hello' action I get the following error:
> "There is no Action mapped for namespace [/] and action name [hello] associated with
context path [/Struts2_Annotations_Mvn]."
>
> - And HelloAction.java (org.apache.struts.struts2annotations.action.HelloAction.java):
>
> public String execute() throws Exception { logger.info("In execute
> method of class Hello"); message = "Hello from Struts 2 with no XML
> configuration."; return SUCCESS; }
>
> Is it possible to fix this project?

Yes, you can do it on your own to learn something, basically follow RegisterAction setup.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@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.

______________________


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Mime
View raw message