It's not a secret anymore!
The moose likes Struts and the fly likes State in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "State in Struts" Watch "State in Struts" New topic

State in Struts

Ron Perich
Ranch Hand

Joined: Mar 25, 2003
Posts: 41
This may be somewhat difficult to explain, but I'll give it a shot. Your thought are appreciated.

I have a Struts w/ Tiles application I am developing. I have a sidebar containing menus A, B, and C. I would like for each of these menus to maintain their state when the user changes them (e.g., minimize/maximize) so that the next time the user logs into the system, it will show up exactly the same way. I have all of the code written to maintain the state in the persistence layer and everything works fine.

However, I have no idea on how I can get the user back to the exact page they were viewing when they change the state of a menu. Right now, I have it going back to the application home page, but that's really not user-friendly.

I was hoping you wise folks might have come across a similar situation and could help me address this issue:

How can I get the user back to the exact same page they were looking at when the state of Menu A, B, or C changes?

Thanks in advance for your help!

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63844

Moving to the Frameworks forum.

[Asking smart questions] [About Bear] [Books by Bear]
Ron Perich
Ranch Hand

Joined: Mar 25, 2003
Posts: 41
Anyone have any thoughts on this?
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
I think you can store the URL of the page in Session and then on change of each menu you can check to see if the session has any url then move to that url otherwise to the main page.

Will this help?

Ron Perich
Ranch Hand

Joined: Mar 25, 2003
Posts: 41
The problem with this approach is that we need to keep the exact parameters used becuase we are using LookupDispatchActions and using a methodToCall parameter to make sure we call the correct method.

We are going to process the request to save the state in another web screen so the main screen does not change. We'll hide the new window as much as possible and we'll close it upon the request being successfully processed.

Thanks for the input.
I agree. Here's the link:
subject: State in Struts
It's not a secret anymore!