Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link to last version of stateful page

I have a number of stateful pages with some state for each page. For example each page has a form that was submitted.

How can I organize a menu with links to last versions of these stateful pages? Should I store anywhere (may be in the session) reference to appropriate object for each page? If I use

onClick() { setResponsePage(MyPage.class); }

than I lose the previous state of the page. I want to link to last state of the page.

like image 334
Yuriy Yudin Avatar asked Nov 11 '22 22:11

Yuriy Yudin


1 Answers

Each time the page is rendered store the page's id in the session.

int pageId = pageInstance.getPageId();

A list or stack data structure could be used to hold the identifiers.

You can implement the navigation menu using a repeater (RepeatingView or such) that creates a new link for each page id in the session.

In the link's click handler you can redirect the user as follows:

Page pageInstance = (Page) new PageProvider(pageId, null).getPageInstance();
setResponsePage(pageInstance);
like image 135
iluwatar Avatar answered Jan 04 '23 03:01

iluwatar