You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeff Smith <je...@centralscheduling.net> on 2003/03/21 16:12:58 UTC

[Q] Return-to-page - is there a slick solution?

My user is on his favorite page (one of many report pages he can choose
from). From there, I want to offer a number of "utility" sequences that he
can run - say Edit Profile, Change Preferences, etc. Each of these sequences
may be 1 page or a sequence of 2 or 3. I want to keep track of which page he
was on when he started and then return to that page at the end of the
sequence.

I could easily track that info in the first action step, put it into the
session scope and then pop back there at the end. But that seems to
circumvent the entire struts action forwarding mechanism.

I could grab the Action Mapping Input field, but that presumes that I will
only invoke my sequence from one place.

Struts appears to be missing a mechanism for these "subroutine-like"
sequences.

Does anybody have an elegant solution to this problem?

Jefficus


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


Re: [Q] Return-to-page - is there a slick solution?

Posted by Jeff Smith <je...@centralscheduling.net>.
> From: "Ian Hunter" <ih...@hunterweb.net>
> From the main page, I have the option for each user to "ask" for
membership
> in any group they don't currently belong in.  They can hit one button that
> forwards to a different action (groupinterest.do), with a forward called
> "returnto" set to the main page.  That action calls the exact same class
as
> updategroup.do, but that class knows to look for a forward called
"returnto"
> and either return to it or "pass it along" by storing it as a session
> variable.  When I do that, I store the entire ActionForward object, not
just
> the page name, so I catch requests to redirect as well as any other
strange
> config details of that forward.

So, if I follow this (and I'm not sure I do - either too much coffee or not
enough :-) you've created an "indirection" step in your sequence that knows
where to jump back to. I understand the part about tracking the entire
ActionForward so that you pick up all the nuances of the forward params.

Having re-read my posting, I realize I might not have been clear on one of
the problem points - there are dozens of pages from which my user may choose
to start this sequence. Doesn't your solution require a separate
"indirection" step for each potential starting point - in order to code the
approprite returnto forward?

But you raise a very good point, that David's suggestion (simply caching the
originating page name at sequence start time) doesn't address - capturing
the nuances of the returnto page forward, such as redirect=true/false or
perhaps even URL parameters.

Jefficus


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


Re: [Q] Return-to-page - is there a slick solution?

Posted by Ian Hunter <ih...@hunterweb.net>.
I had a similar problem recently.  I have a series of actions that populate
a formbean from a database, forward to a JSP for editing, and those submit
to a different action for handling updates and cascaded things that must
happen based on business rules.

I also want to be able to link directly to the update action in some cases
where I have all the fields I want to change.

For instance, say I have a user/group/access table.  I can edit a particular
user's priviledges by called "groupmaint.do" or with the ID of the user in
question.  That action (EditGroupMemAction) populates a three field bean
(Member ID, Group ID, Access Level) and forwards to groupmaint.jsp -- the
details get edited, then posted to updategroup.do which updates the
database, etc. and forwards back to the starting page.

>From the main page, I have the option for each user to "ask" for membership
in any group they don't currently belong in.  They can hit one button that
forwards to a different action (groupinterest.do), with a forward called
"returnto" set to the main page.  That action calls the exact same class as
updategroup.do, but that class knows to look for a forward called "returnto"
and either return to it or "pass it along" by storing it as a session
variable.  When I do that, I store the entire ActionForward object, not just
the page name, so I catch requests to redirect as well as any other strange
config details of that forward.

Does that help?

----- Original Message -----
From: "Jeff Smith" <je...@centralscheduling.net>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, March 21, 2003 10:12 AM
Subject: [Q] Return-to-page - is there a slick solution?


> My user is on his favorite page (one of many report pages he can choose
> from). From there, I want to offer a number of "utility" sequences that he
> can run - say Edit Profile, Change Preferences, etc. Each of these
sequences
> may be 1 page or a sequence of 2 or 3. I want to keep track of which page
he
> was on when he started and then return to that page at the end of the
> sequence.
>
> I could easily track that info in the first action step, put it into the
> session scope and then pop back there at the end. But that seems to
> circumvent the entire struts action forwarding mechanism.
>
> I could grab the Action Mapping Input field, but that presumes that I will
> only invoke my sequence from one place.
>
> Struts appears to be missing a mechanism for these "subroutine-like"
> sequences.
>
> Does anybody have an elegant solution to this problem?
>
> Jefficus
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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