You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Greg Ludington <gl...@gmail.com> on 2007/06/07 18:48:06 UTC

[S2] Question on inherited Actions and Results

If I have two namespaces, a parent and a child, on an Action not
defined in the child, should a the Result direct the user to the
parent namespace, or the child one?  The wiki page on redirect-action
states that, for namespace, "If namespace is null, this defaults to
the current namespace"  Does that refer to the currently active
namespace, or the namespace in which the Action is defined?

In other words (using xml configs):

<package name="default" namespace="/">
    ...
   <action name="sample" class="foo.bar.bat.sample">
       ...
      <result name="input">/inputForm.jsp</input>
      <result name="success" type="redirect-action">
           <param name="actionName">otherAction</param>
      </result>
    </action>
</package>

  <package name="child" namespace="/child" extends="default">
      <!-- action "sample" not defined in child namespace -->
   </package>

If a user goes to /child/sample.action and successfully submits the
form, the redirect-action will send them to /otherAction.action, not
to /child/otherAction.  (For that matter, since I am using the
namespace to establish paths to css and other static resources, it
appears that the input result also points back to the default
namespace, not the child.)

Would this be a bug, or is this the designed behavior, and Results are
not intended to inherit in such a way as I am trying?

Thank you,
Greg Ludington

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


Re: [S2] Question on inherited Actions and Results

Posted by Greg Ludington <gl...@gmail.com>.
Upon closer look, it appears that somebody had checked in a
namespace="/" on the s:form tag, which was causing this behavior.
Struts inheritance is working as expected; the problem was on our end.

Thanks,
Greg Ludington

On 6/7/07, Greg Ludington <gl...@gmail.com> wrote:
> If I have two namespaces, a parent and a child, on an Action not
> defined in the child, should a the Result direct the user to the
> parent namespace, or the child one?  The wiki page on redirect-action
> states that, for namespace, "If namespace is null, this defaults to
> the current namespace"  Does that refer to the currently active
> namespace, or the namespace in which the Action is defined?
>
> In other words (using xml configs):
>
> <package name="default" namespace="/">
>     ...
>    <action name="sample" class="foo.bar.bat.sample">
>        ...
>       <result name="input">/inputForm.jsp</input>
>       <result name="success" type="redirect-action">
>            <param name="actionName">otherAction</param>
>       </result>
>     </action>
> </package>
>
>   <package name="child" namespace="/child" extends="default">
>       <!-- action "sample" not defined in child namespace -->
>    </package>
>
> If a user goes to /child/sample.action and successfully submits the
> form, the redirect-action will send them to /otherAction.action, not
> to /child/otherAction.  (For that matter, since I am using the
> namespace to establish paths to css and other static resources, it
> appears that the input result also points back to the default
> namespace, not the child.)
>
> Would this be a bug, or is this the designed behavior, and Results are
> not intended to inherit in such a way as I am trying?
>
> Thank you,
> Greg Ludington
>

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