Hi Lukasz,

Thank you very much for your attention, it's really nice to have detailed
examples in the docs.
But unfortunately it's still not working for me. I've followed the example
exactly as the docs, but all the properties from SomeAction are being
copied. In the /result.jsp page I have this:

<s:textfield name="prop1" label="prop1" autocomplete="off"/>
<s:textfield name="prop2" label="prop2" autocomplete="off"/>
<s:textfield name="prop3" label="prop3" autocomplete="off"/>
<s:textfield name="prop4" label="prop4" autocomplete="off"/>
<s:textfield name="prop5" label="prop5" autocomplete="off"/>
<s:textfield name="prop6" label="prop6" autocomplete="off"/>
<s:textfield name="prop7" label="prop7" autocomplete="off"/>

The "SomeAction" class has prop1 to prop5.
The "OtherAction" class has prop6 and prop7.

And I have the test.jsp with this:

<s:form action="someAction" >
        <s:textfield name="prop1" />
        <s:textfield name="prop2" />
        <s:textfield name="prop3" />
        <s:textfield name="prop4" />
        <s:textfield name="prop5" />
        <s:submit />
</s:form>

So my testing example is very simple: test.jsp calls someAction and
populates prop1 to 5. Then it's chained into otherAction which populates
prop6 and prop7 and finally we get the result into result.jsp.

Whenever I chain someAction to otherAction, I can see all the values from
prop1 to prop7 in the result.jsp page, even though I'm setting the
chain.includes to be only prop1.
In the other hand, whenever I redirectAction someAction to otherAction, I
can only see the values from prop6 and prop7 in the result page, just as
one expects (because whenever you redirect actions, the context from one
action is not copied to the other, right?).

Lukasz, please, do you have a Struts 2 project with a working example of
the chaining includes/excludes? If anyone is interested, I think I can
share my failing test project somewhere too.

Regards,
Masaki





On Wed, Jan 14, 2015 at 8:28 AM, Lukasz Lenart <lukaszlen...@apache.org>
wrote:

> Here is the proper configuration, see my comments below
>
> <action name="chain1" class="example.Login">
>     <interceptor-ref name="basicStack"/>
>     <result name="success" type="chain">
>         <param name="actionName">chain2</param>
>     </result>
> </action>
> <action name="chain2" class="example.HelloWorld" >
>     <interceptor-ref name="chainStack">
>         <param name="chain.includes">username</param>
>     </interceptor-ref>
>     <result>/WEB-INF/jsp/example/HelloWorld.jsp</result>
> </action>
>
> 2015-01-13 3:39 GMT+01:00 Tenchi Masaki <koouy...@gmail.com>:
> > Yes, at first I thought that I was supposed to pass the "includes" param
> > into the "chain" result like this:
> >
> > <action name="someAction" class="com.examples.SomeAction">
> >        <interceptor-ref name="basicStack"/>
> >         <result name="success" type="chain">
> >             <param name="actionName">otherAction</param>
> >             <param name="includes">prop1</param>
> >         </result>
> > </action>
>
> ChainResult doesn't contain "includes" - it must be defined on
> ChainInterceptor
>
> > <action name="otherAction" class="com.examples.OtherAction" >
> >         <interceptor-ref name="chain" />
> >         <interceptor-ref name="basicStack"/>
> >         <result name="success">/result.jsp</result>
> > </action>
>
> There is "chainStack" which you can use instead of "chain" & "basicStack"
>
> > But it doesn't work.
>
> Yes as you must define "includes" for the result action (it strange
> for me too and sorry for misleading you ... but it makes sense :) )
>
> > I've tried this too and no success (actually it doesn't make sense at
> all,
> > so it's good that it does not work.. lol):
> >
> > <action name="someAction" class="com.examples.SomeAction">
> >         <interceptor-ref name="basicStack">
> >             <param name="includes">prop1</param>
>
> "basicStack" doesn't include "chain" interceptor, it won't work
> either, instead you can do it like this
>
> <interceptor-ref name="chainStack">
>     <param name="chain.includes">prop1</param>
> </interceptor-ref>
>
> >         </interceptor-ref>
> >         <result name="success" type="chain">
> >             <param name="actionName">otherAction</param>
> >         </result>
> > </action>
> > <action name="otherAction" class="com.examples.OtherAction" >
> >         <interceptor-ref name="chain" />
> >         <interceptor-ref name="basicStack"/>
> >         <result name="success">/result.jsp</result>
> > </action>
> >
> > And last:
> >
> > <action name="someAction" class="com.examples.SomeAction">
> >         <interceptor-ref name="chain" >
> >             <param name="includes">prop1</param>
> >         </interceptor-ref>
> >         <interceptor-ref name="basicStack"/>
> >         <result name="success" type="chain">
> >             <param name="actionName">otherAction</param>
> >         </result>
> > </action>
> > <action name="otherAction" class="com.examples.OtherAction" >
> >         <result name="success">/result.jsp</result>
> > </action>
>
> Almost there, but just move <interceptor-ref name="chain" > to the second
> action
>
> And to close this issue I have updated the docs - thanks for support!
> https://cwiki.apache.org/confluence/display/WW/Chaining+Interceptor
>
>
>
> Regards
> --
> Ɓukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to