Dunno exactly what your requirements are, but you could use a history object in the 
session for this sorta thing.  I used a List for our "breadcrumb" links once before, 
stored on the session.  In my abstract superclass Action object, I would push the 
current request URL onto the head of the List with each request.  I had a fixed length 
List, just removing the tail after it reached capacity so that it operated like a 
queue.  If you're always going to return to the previous page, this is an easy way to 
deal with it.  You would just do something like this in your subclasses:

MyListImpl list = (MyListImpl)request.getSession().getAttribute("MY_LIST_IMPL");
String last = list.getPreviousRequest();  // This will be the second-to-last object 
added to the list
return new ActionForward(last);


If you're returning to a page 2 or 3 requests ago, things obviously get more 
complicated.  Note that you can do this without an abstract Action superclass if you 
like, just stick a ServletFilter on the ActionServlet to manage your List instead.


hope this helps,
Joe

> -----Original Message-----
> From: Davide Bruzzone [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 10, 2003 2:53 PM
> To: 'Struts Users Mailing List'
> Subject: Suggestions/best practices for accessing the same page/view
> from different locations within the application/workflows...
> 
> 
> Greetings all...
> 
> I just wanted to find out if anyone has any suggestions or 
> best practices
> gained from experience with regard to accessing the same page 
> from different
> locations within the application/workflows...
> 
> Here's the scenario:
> 
> 1) I have a page called MyPage.
> 2) Its possible to access MyPage directly from the main menu. 
> When this
> happens, clicking the "Done" or "Save" or "Cancel" or 
> whatever buttons on
> MyPage should return the user to the main menu.
> 3) Its also possible to access MyPage by going from the main menu to
> AnotherPage, then to MyPage (from AnotherPage). When this 
> happens, clicking
> the "Done" or "Save" or "Cancel" or whatever buttons on 
> MyPage should return
> the user to AnotherPage.
> 4) ...Ad nauseam...
> 
> In short, where the buttons on a page take the user next can 
> change, and
> depends on where they came from.
> 
> I've taken a brief look at the Struts Workflow extensions 
> that I read about
> on the list, but it wasn't immediately clear to me how they 
> could be used to
> do what I just described. Should I be looking harder?
> 
> Cheers...
> 
> Dave Bruzzone
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to