You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by hernan gonzalez <hg...@gmail.com> on 2007/11/14 18:59:19 UTC

struts2: some action mapping clarificacions needed

I have a wildcard mapping, say

  <action name="CarCRUD_*" method="{1}" class="myCarCRUAction">

If I have a form
<s:form action="CarCRUD_load">...
which results in (html stripped)
<form action="/Presentation/test/CarCRUD_load.do2">
and inside I have some submit buttons which go to other methods (besides load)
I can accomplish that by using the "method" and "action" attrbiute of
the "submit" struts-tag,
eg
    <s:submit value="Borrar" action="CarCRUD_delete"   />   (case 1)
    <s:submit value="Do1" method="met1"  />                      (case 2)
This would invoke the delete() and met1() methods in my action class,
respectively.
The magic, as I see, is done by struts-tag by inserting the http parameters
   action:CarCRUD_delete=Borrar
   method:met1=Do1
respectively in the resultant request. But the url of the request is
still "/myapp/CarCRUD_load.do2"
Then...
Am I to deduce that Struts2, BEFORE going to the struts.xml file, when
it must determine
the action name, replaces the standard action according to the url
(ie. CarCRUD_load )
if it finds some "action:xxx" parameter (in the first case)  ?
(say: it assumes that the action name is "CarCRUD_delete" and from
them it continues
as usual) ?
And that, (in the second case),  AFTER having deterined the method
name according to the standard
rule ( CarCRUD_load ) , finds the matching action mapping in
struts.xml, BUT instead of applying the
pattern matching rule, as it finds some "method:xxx" parameter in the
request , uses that method ?
Is this so ?
Is there some place in the documentation to see this behaviour ?
Is there other way of setting the method name ? (eg: with a -fixed
named- parameter VALUE ) ?

Hernán

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


Re: struts2: some action mapping clarificacions needed

Posted by Omkar patil <os...@gmail.com>.
Read through the javadocs for DefaultActionMapper.

hernan gonzalez wrote:
> I have a wildcard mapping, say
>
>   <action name="CarCRUD_*" method="{1}" class="myCarCRUAction">
>
> If I have a form
> <s:form action="CarCRUD_load">...
> which results in (html stripped)
> <form action="/Presentation/test/CarCRUD_load.do2">
> and inside I have some submit buttons which go to other methods (besides load)
> I can accomplish that by using the "method" and "action" attrbiute of
> the "submit" struts-tag,
> eg
>     <s:submit value="Borrar" action="CarCRUD_delete"   />   (case 1)
>     <s:submit value="Do1" method="met1"  />                      (case 2)
> This would invoke the delete() and met1() methods in my action class,
> respectively.
> The magic, as I see, is done by struts-tag by inserting the http parameters
>    action:CarCRUD_delete=Borrar
>    method:met1=Do1
> respectively in the resultant request. But the url of the request is
> still "/myapp/CarCRUD_load.do2"
> Then...
> Am I to deduce that Struts2, BEFORE going to the struts.xml file, when
> it must determine
> the action name, replaces the standard action according to the url
> (ie. CarCRUD_load )
> if it finds some "action:xxx" parameter (in the first case)  ?
> (say: it assumes that the action name is "CarCRUD_delete" and from
> them it continues
> as usual) ?
> And that, (in the second case),  AFTER having deterined the method
> name according to the standard
> rule ( CarCRUD_load ) , finds the matching action mapping in
> struts.xml, BUT instead of applying the
> pattern matching rule, as it finds some "method:xxx" parameter in the
> request , uses that method ?
> Is this so ?
> Is there some place in the documentation to see this behaviour ?
> Is there other way of setting the method name ? (eg: with a -fixed
> named- parameter VALUE ) ?
>
> Hernán
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>   


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