pixologe wrote:
>
> Ah - I see, SLCPM is private :(
> Thanks for the link, this solution works fine :)
>
Are you altering the visibility of detach()?
I have a somewhat more complicated solution which does not require
modification to wicket.
In my base page I store a reference to the page every time it is rendered in
the Session meta data. Some other solutions I have read use the page number
which may not be the last page shown.
This seems to work well. The code is below and you just call
MyBasePage.goToLastPage() to go back.
class MyBasePage extends WebPage
{
@Override
protected void onBeforeRender()
{
storeCurrentPage();
super.onBeforeRender();
}
private void storeCurrentPage()
{
PageIdVersion pageIdVersion = new PageIdVersion();
pageIdVersion.id = getNumericId();
pageIdVersion.version = getVersions() - 1;
IPageMap pageMap= getPageMap();
HashMap<String,PageIdVersion> lastPageMap =
getSession().getMetaData(lastPageIdVersionKey);
if (lastPageMap == null)
{
lastPageMap = new HashMap<String, PageIdVersion>();
getSession().setMetaData(lastPageIdVersionKey,
lastPageMap);
}
PageIdVersion current = lastPageMap.get(pageMap.getName());
if (current != null)
{
if (current.equals(pageIdVersion))
{
// refresh of current page
return;
}
pageIdVersion.last = current;
current.last = null;
}
lastPageMap.put(pageMap.getName(), pageIdVersion);
}
public void gotoLastPage()
{
HashMap<String, PageIdVersion> lastPageMap =
getSession().getMetaData(lastPageIdVersionKey);
PageIdVersion pageIdVersion =
lastPageMap.get(getPageMap().getName()).last;
Page page = getPageMap().get(pageIdVersion.id,
pageIdVersion.version);
setResponsePage(page);
}
}
John
--
View this message in context:
http://www.nabble.com/Possible-to-retrieve-previous-page-from-PageMap-tp20861106p20916678.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]