You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by wild_oscar <mi...@almeida.at> on 2007/11/19 13:00:55 UTC
Ajax form submit - problem with Struts2 annotations?
I tried following the Ajax tutorial in
http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html
http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html ,
adapting it to a test application I already had.
I have a weird behaviour with a form submit:
<s:form action="user" method="save" >
<s:textfield id="id2" name="userid" />
<s:submit action="user" method="save" theme="ajax"/>
</s:form>
This code does not trigger the Save method of the UserAction action. If I
add an execute() method, it will trigger this method of the action. (note
that I have tried the s:submit without action and method parameters - they
are already in the action - without any success).
If I remove the "ajax" theme of the submit action, it will execute the save
method.
I use annotations for struts2 actions. Is there any incompatibility between
dojo and annotations?
An s:a link set to the save() method works well. I tried this s:a link:
<s:url id="urlId" action="user" method="save">
<s:param name="id" value="%{userid}" />
</s:url>
<s:a id="xxx" theme="ajax" href="%{urlId}" targets="persons"
notifyTopics="/save">Test</s:a>
Does anyone know why the submit button does not work?
--
View this message in context: http://www.nabble.com/Ajax-form-submit---problem-with-Struts2-annotations--tf4835849.html#a13834818
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Ajax form submit - problem with Struts2 annotations?
Posted by wild_oscar <mi...@almeida.at>.
On an update to this issue, it seems that the s:submit tag with an ajax theme
does not work when Struts2's action is configured with Annotations.
If I switch action configuration to struts.xml, it will execute the correct
method.
In summary, when I try to execute the save method of my action, I get:
annotated action + ajax theme s:submit - execute
annotated action + ajax theme s:url - save
struts.xml action + ajax theme s:submit - save
struts.xml action + ajax theme s:url - save
Can anyone confirm this bug?
wild_oscar wrote:
>
> I tried following the Ajax tutorial in
> http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html
> http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html ,
> adapting it to a test application I already had.
>
> I have a weird behaviour with a form submit:
>
> <s:form action="user" method="save" >
> <s:textfield id="id2" name="userid" />
> <s:submit action="user" method="save" theme="ajax"/>
> </s:form>
>
> This code does not trigger the Save method of the UserAction action. If I
> add an execute() method, it will trigger this method of the action. (note
> that I have tried the s:submit without action and method parameters - they
> are already in the action - without any success).
>
> If I remove the "ajax" theme of the submit action, it will execute the
> save method.
>
> I use annotations for struts2 actions. Is there any incompatibility
> between dojo and annotations?
>
> An s:a link set to the save() method works well. I tried this s:a link:
>
> <s:url id="urlId" action="user" method="save">
> <s:param name="id" value="%{userid}" />
> </s:url>
> <s:a id="xxx" theme="ajax" href="%{urlId}" targets="persons"
> notifyTopics="/save">Test</s:a>
>
> Does anyone know why the submit button does not work?
>
--
View this message in context: http://www.nabble.com/Ajax-form-submit---problem-with-Struts2-annotations--tf4835849.html#a13876490
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org