You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stjepan Brbot <st...@t.ht.hr> on 2005/02/21 12:59:10 UTC

Chaining DispatchAction method actions

Hi,

I have one DispatchAction type action [/Person.do] with the following 
methods "list","populate" and "update":
1) Code inside "list" method populates the list of all users, sets this 
list inside request and redirects this request on [PersonList.jsp] page 
which makes persons presentation. Each person entry (row) on this page 
has a link for entry editing pointing to PersonAction with 
"method=populate" and "personID" as a second attribute (e.g. 
/Person.do?method=populate&userID=100).
2) Code inside "populate" method retrieves the data from DB, populates 
[PersonForm] and presents [PersonEdit.jsp] page with existing data for 
that person. Data from this form are submitted to (again) Person action 
with "method=update".
3) Code inside "update" takes new data from PersonForm and updates 
underlying DB. After update, I need forwarding/redirecting data back to 
Person action with method=list.

How to make redirection to this Person with method=list?

I can do it by returning complete new ActionForward object - return new 
ActionForward("/Person.do?method=list") - but this is hard coded mapping 
link - not in spirit of STRUTS. I'd like to take forwarding address from 
mapping object having the ability to manage action flow from central 
config file! If I set reqest.setAttribute("method","list") and make 
forward with mapping.getForward("Person") - it does not work!

Stjepan Brbot

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


Re: Chaining DispatchAction method actions

Posted by Dakota Jack <da...@gmail.com>.
<snip>
> After update, I need forwarding/redirecting data back to
> Person action with method=list.
</snip>

No, you don't.  Just put the required code into the update and forward
to wherever you want to forward.  Why forward when you need more
processing?  Do the processing, then forward.

Jack

-- 
"You can lead a horse to water but you cannot make it float on its back."
"Heaven has changed.  The Sky now goes all the way to our feet.

~Dakota Jack~

"This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose, or take any action based
on this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation."

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