Hi Wesw,
Thanks for the reply.  Yes, I meant to say testChain().  Thanks for that.

So, how is the old data being retained.  Does it take it from the http
request and recreates the new instance?

If that is the case, what other options do I have to get the changed data
into the chained method?

Thanks

Satya

On Tue, Apr 21, 2009 at 9:55 PM, Wes Wannemacher <w...@wantii.com> wrote:

> On Wednesday 22 April 2009 00:36:36 satyanarayana katta wrote:
> > Hi All,
> > I have a Action class
> >
> > class BaseAction extends ActionSupport {
> >     private Sting data;
> >
> >     public void getData() {
> >         return this.data;
> >     }
> >
> >    public String setData(String data){
> >        this.data = data;
> >    }
> > }
> >
> > class Action extends BaseAction{
> >     public String execute() throws Exception {
> >         System.out.println(getData());
> >         setData("abc");
> >         return "chain";
> >     }
> >
> >     public String executeChain() throws Exception {
> >         System.out.println(getData());
> >         return "success"
> >     }
> > }
> >
> > xml configuration:
> >
> > <action name="test" class="Action">
> > <result name="chain">test2</result>
> > </action>
> >
> > <action name="test2" class="Action" method="execute1">
> > <result name="chain"></result>
> > </action>
> >
> >
> >
> > http://localhost:8080/test/test.action?data=ball
> >
> > Output of execute:  ball
> > Output of execute1:  ball
> >
> > I am expecting the out of execute1 as "abc"
> >
> > Am I missing something please help me resolve the issue.
> >
> > Rgds,
> >
> > Satya
>
> The configuration of test2 points to method execute1, but your action has
> executeChain(). I assume that's a typo. My (somewhat educated) guess is
> that
> when you chain to the next action, even though it is the same class, a new
> instance is created. In the new instance, setData(String) is never called
> since it is only called in the execute method.
>
> -Wes
> --
>
> Wes Wannemacher
> Author - Struts 2 In Practice
> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> http://www.manning.com/wannemacher
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to