2013/3/21 Álvaro López López <[email protected]>:
> 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: [email protected]
For additional commands, e-mail: [email protected]