You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by fa...@bt.com on 2005/10/05 12:47:04 UTC

chaining actions i think!!

Hi,
 
Is there a way that I can call another action from within a action
class.  Is it as simple as just calling the execute method of the other
action or another method of the action class as is required.?
 
My scenario is as follows: A user searches on a client and is returned a
number of results.  He then chooses to edit one of the results and goes
to the edit jsp.  After editing the user has the option of returning
back to the search results.  
 
To show the record that has been edited I am making another trip to the
DB as I don't have a cache.  To return back to the results the user
clicks on his button and is forwarded to the edit Action class.  It is
from this action class that I want to call the search Action class
passing in the search form which is held in the session.  This will then
go to the DB and return to the appropriate search jsp.
 
Any one any views on this
 
Thanks

Re: chaining actions i think!!

Posted by Tamas Szabo <sz...@gmail.com>.
Hi!

To show the record that has been edited I am making another trip to the
> DB as I don't have a cache. To return back to the results the user
> clicks on his button and is forwarded to the edit Action class. It is
> from this action class that I want to call the search Action class
> passing in the search form which is held in the session. This will then
> go to the DB and return to the appropriate search jsp.


I'm not sure that I understand this correctly, but can't you just
forward to the search Action class from the edit Action class?

Tamas

Re: chaining actions i think!!

Posted by Martin Gainty <mg...@hotmail.com>.
I am unsure if you want to chain actions as this would not conform to
 Action1->ActionForward1 where the design is meant to handle one action at a 
time

store it as session variable and access it later
Action...
  execute(...

       HttpSession session = request.getSession();
        session.setAttribute("username",  username);
test for presence of session.getAttribute("username") and result if not null 
prepopulate your form with the value

Anyone else ?
Martin-
----- Original Message ----- 
From: <fa...@bt.com>
To: <us...@struts.apache.org>
Sent: Wednesday, October 05, 2005 6:47 AM
Subject: chaining actions i think!!


Hi,

Is there a way that I can call another action from within a action
class.  Is it as simple as just calling the execute method of the other
action or another method of the action class as is required.?

My scenario is as follows: A user searches on a client and is returned a
number of results.  He then chooses to edit one of the results and goes
to the edit jsp.  After editing the user has the option of returning
back to the search results.

To show the record that has been edited I am making another trip to the
DB as I don't have a cache.  To return back to the results the user
clicks on his button and is forwarded to the edit Action class.  It is
from this action class that I want to call the search Action class
passing in the search form which is held in the session.  This will then
go to the DB and return to the appropriate search jsp.

Any one any views on this

Thanks

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


Re: chaining actions i think!!

Posted by Su...@Keane.com.
Faisal,

Why are you making different action classes for Search and Edit 
functionality. You can have these method in one Action class itself and 
then you can call the 'search action mapping' from 'edit action mapping' 
defined in struts-config.xml. If you want more detail that how to do it, 
let me know.

Sunil



<fa...@bt.com> 
05/10/2005 16:17
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>


To
<us...@struts.apache.org>
cc

Subject
chaining actions i think!!






Hi,
 
Is there a way that I can call another action from within a action
class.  Is it as simple as just calling the execute method of the other
action or another method of the action class as is required.?
 
My scenario is as follows: A user searches on a client and is returned a
number of results.  He then chooses to edit one of the results and goes
to the edit jsp.  After editing the user has the option of returning
back to the search results. 
 
To show the record that has been edited I am making another trip to the
DB as I don't have a cache.  To return back to the results the user
clicks on his button and is forwarded to the edit Action class.  It is
from this action class that I want to call the search Action class
passing in the search form which is held in the session.  This will then
go to the DB and return to the appropriate search jsp.
 
Any one any views on this
 
Thanks