to be honest i haven't read the whole thread, but we are also trying
to achieve roughly the same thing.

as of wicket 1.4-m1 there is a class called PageId that you may want
to consider.

i created a "back state holder" class that holds a PageId and an
IModel<String> for the text of the back link. so for every visited
page (in the onBeforeRender - could be placed in the base page), we
set a holder in the session and in our base page we call
Session.get.getHolder.  pretty simple really.
as the PageId class is a unique identifier of the page you can use it
to distinguish between pagemaps, etc. (so navigation doesn't interfere
between tabs / windows)

this fulfills our usecase, as this is just a helper link to "go back
where you were". we don't completely rely on this link because we also
do keep traditional navigation links in our pages.

however i still need to solve the double click problem, i.e. if a user
clicks twice on a link, the last rendered page will be the same as the
one he is in. thus, the back link points to the same page.  it is
actually quite tricky to get it right, yet i believe possible. i will
definitely try to avoid the link handing over pageparams in the url
"like in the good old days" :)

i will post it once i get everything working together.

francisco





On Fri, Mar 13, 2009 at 10:29 AM, pixologe <pixol...@mailinator.com> wrote:
>
> Just a thought which I did not think about when implementing this (thus I had
> to change this stuff all over afterwards), perhaps it helps someone avoiding
> the same mistake:
>
> The latest rendered page is not neccessarily the page that lead the user to
> the current page.
> I.e. retrieving the last page this way might result in strange behavior if
> the user uses two browser windows or tabs simulaneously. Same applies for
> clicking the browser's back button.
>
> Thus I had to go back to a rather old-fashioned solution, where every link
> hands over a page param :-/ like in the good old days ;-)
>
>
>
>
>
> rolandpeng wrote:
>>
>> great! after delare a ineer class below:
>>       class PageIdVersion {
>>               public int id;
>>               public int version;
>>               public PageIdVersion last;
>>       }
>> then the track function works.
>>
>>
>> John Patterson wrote:
>>>
>>>
>>>      // must declare hash map because meta data must be serializable
>>>      private MetaDataKey<HashMap<String, PageIdVersion>> 
>>> lastPageIdVersionKey
>>> = new MetaDataKey<HashMap<String, PageIdVersion>>() {};
>>>
>>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Possible-to-retrieve-previous-page-from-PageMap-tp20861106p22492628.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to