Hi Uwe,

   Thanks for your reply.   Perhaps you wouldn't mind providing me with a
little bit of clarification on your technique of going back to previously
visited pages.

My application is structured like:

- abstract BasePage at the top of the Page hierarchy with a
BookmarkablePageLink to LoginPage
- AppPage extends BasePage is the main application page is mounted with
HybridURLCoding
- LoginPage extends BasePage and is mounted with HybridURLCoding
- there are other pages that extend BasePage for which the Login link is
present
- LoginPage has an AjaxForm for submitting username/password, etc.. 

When I'm at AppPage {"1=foo"} and click on the Login link, I then go to the
LoginPage with a nice URL showing in the address bar.  After submitting the
login form and upon successful authentication, I want to automatically
navigate back to AppPage {"1=foo"} so that it is re-rendered to take into
account he user is now authenticated and consequently has more authority.

Currently what I am doing is to check the referrer in the onSubmit of the
AJAX form in LoginPage and going back to that, which brings me to the
LoginPage for some reason.

I tried to get WebPage.continueToOriginalDestination() to work in the
onSubmit and by throwing a RedirectToInterceptPage exception when clicking
on the login link, but that didn't work either.

At first glance, it seems that your solution would work the best as you have
the ability to store information in the MetaData portion of the components. 
Please allow me to annotate your pseudo-code so that you can hopefully
clarify some of my questions:

>> Basically, Page targetPage = new LoginPage(new PageParameters());
>> (LoginPage doesn't have any parameters)
Page targetPage = new BookmarkablePageClass(...

>> create a setPageToNavigateBackTo(Page) method to store the AppPage
>> instance
// the add state to it, like
targetPage.setPageToNavigateBackTo(getWebPage());

>> store AppPage's PageParameters in the
>> HybridUrlCodingStrategy.PAGE_PARAMETERS_META_DATA_KEY
>> key so the onSubmit can redirect back
// and add params for the URL
targetPage.setMetaData(HybridUrlCodingStrategy.PAGE_PARAMETERS_META_DATA_KEY, 
new PageParameters(...));
>> go to LoginPage
setResponsePage(targetPage);



By following the above implementation, would it not be a tad wasteful
creating LoginPage instances every time any BasePage sibling is created?  

What about adding a setter in LoginPage like  LoginPage.setBackPage(Class
pageClass, PageParameters pp)?  I suppose this would also require the
pre-instantiation of LoginPage as well.

Are there no other mechanisms for solving this problem?  Perhaps I should
look how Breadcrumbs are implemented as they have similar requirements.


Many thanks




Uwe Schäfer wrote:
> 
> classacts schrieb:
> 
>> Let's say I'm on bookmarkable Page1.class with PageParameters
>> {"id=1,0=foo,1=bar"} and I click on a BookmarkablePage link to ConfigPage
>> PageParameters {"id=1"} and do some stuff like submit forms on that page,
>> etc... How can I place a Back button or link to the Page1.class with its
>> PageParameters intact?  The mechanism should also would even if the
>> originating page isn't Page1.class but any arbitrary class.
> 
> *IF* i get this correctly, we do that by using HybridURLEncoding and 
> passing pageInstances around.
> linking to bookmarkable urls with additional state can be done with smth 
> like:
> 
> Page targetPage = new BookmarkablePageClass(...
> // the add state to it, like
> targetPage.setPageToNavigateBackTo(getWebPage());
> // and add params for the URL
> targetPage.setMetaData(HybridUrlCodingStrategy.PAGE_PARAMETERS_META_DATA_KEY, 
> new PageParameters(...));
> setResponsePage(targetPage);
> 
> cu uwe
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Going-back-to-a-previous-URL--tp19254601p19266318.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]

Reply via email to