Re: Going back to a previous URL?
hi cu uwe, I've tried your mentioned method below to setResponsePage for keeping state in BookmarkablePage. But it doesn't work. here is my implemented codes: -- PageParameters oParam=new PageParameters(); oParam.add(product_oid,String.valueOf(oProduct.getOid())); DetailProduct targetPage=new DetailProduct(); targetPage.setBackPage(this.getPage()); targetPage.setMetaData(HybridUrlCodingStrategy.PAGE_PARAMETERS_META_DATA_KEY, oParam); setResponsePage(targetPage); -- I assumed DetailProduct(PageParameters params) will be called internally. But the process still called DetailProduct() instead of DetailProduct(PageParameters params). So some exception happened. Could you please give me more information about that and any suggestions? Roland. 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: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://www.nabble.com/Going-back-to-a-previous-URL--tp19254601p24387309.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
Re: Going back to a previous URL?
Hi, I know these is not a reply sorry for that. How do i post to nabble wicket user. Can anyone guide I have searched google / nabble but no mention of method to post question Thanks -- View this message in context: http://www.nabble.com/Going-back-to-a-previous-URL--tp19254601p24388119.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
Re: Going back to a previous URL?
It is stated on top of the nabble page. You must subscribe to the mailing list for this. Afterwards you just send an email to users@wicket.apache.org to post a new question. -- View this message in context: http://www.nabble.com/Going-back-to-a-previous-URL--tp19254601p24390934.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
Re: Going back to a previous URL?
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]
Re: Going back to a previous URL?
classacts schrieb: 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. so if not using RestartResponseAtInterceptionPage, what you want is to a) move to a nice looking/bookmarkable url for that login page and b) pass the reference to your current page, so that the targeting page can do setResponsePage(myBackPage); this can be complished using HybridUrlCodingStrategy like below. 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. well it is more about passing data directly to the targeted page, but STILL have a nicelooking and bookmarkable URL. Let´s say you would not care about URLs, what you´d do is: class A extend Page{ ... B b = new B(); b.setWhateverStateYouLike(..); b.setMybackPage(this); setResponsePage(b); ... } class B extends Page { ... setMyBackPage(Page back){this.back=back;} ... new Link(back){ void onClick(){ setResponsePage(back); } } ... } the 'problem' here is - for those, who care about urls - the URL you give to B here does not have parameters. with the mentioned b.setMetaData(HybridUrlCodingStrategy.PAGE_PARAMETERS_META_DATA_KEY, new PageParameters(...)) you could add parameters to the URL. That is it. Basically, Page targetPage = new LoginPage(new PageParameters()); (LoginPage doesn't have any parameters) Page targetPage = new BookmarkablePageClass(... well, you don´t need parameters then ;) By following the above implementation, would it not be a tad wasteful creating LoginPage instances every time any BasePage sibling is created? sure, why would you want to do that? what about new Link(bla){onClick(){setResponsePage(new LoginPage(...);}} ? you´d create it when it is needed then, right? cu uwe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Going back to a previous URL?
Hi Uwe, Thanks for your reply, I understand your technique now. However, what about when we do care about URLs? For example, my LoginPageLink class is as follows: @NonAuthOnly private final class LoginPageLink extends BookmarkablePageLink { private static final long serialVersionUID = 1L; public LoginPageLink(String id) { super(id, LoginPage.class); } // @Override // public void onClick() { // LoginPage lp = new LoginPage(); // lp.setReferringPage(BasePage.this.getPage()); // } } Not really quite sure how to create an instance of LoginPage here and still being able to use BookmarkablePageLink... using Link produces nasty href URLs which I don't want on my public-facing home page. The only solution I can come up with now is to use some Link derivative and create the static URL which will be used in the href to make it look nice while being able to override onClick()... Uwe Schäfer wrote: classacts schrieb: 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. so if not using RestartResponseAtInterceptionPage, what you want is to a) move to a nice looking/bookmarkable url for that login page and b) pass the reference to your current page, so that the targeting page can do setResponsePage(myBackPage); this can be complished using HybridUrlCodingStrategy like below. 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. well it is more about passing data directly to the targeted page, but STILL have a nicelooking and bookmarkable URL. Let´s say you would not care about URLs, what you´d do is: class A extend Page{ ... B b = new B(); b.setWhateverStateYouLike(..); b.setMybackPage(this); setResponsePage(b); ... } class B extends Page { ... setMyBackPage(Page back){this.back=back;} ... new Link(back){ void onClick(){ setResponsePage(back); } } ... } the 'problem' here is - for those, who care about urls - the URL you give to B here does not have parameters. with the mentioned b.setMetaData(HybridUrlCodingStrategy.PAGE_PARAMETERS_META_DATA_KEY, new PageParameters(...)) you could add parameters to the URL. That is it. Basically, Page targetPage = new LoginPage(new PageParameters()); (LoginPage doesn't have any parameters) Page targetPage = new BookmarkablePageClass(... well, you don´t need parameters then ;) By following the above implementation, would it not be a tad wasteful creating LoginPage instances every time any BasePage sibling is created? sure, why would you want to do that? what about new Link(bla){onClick(){setResponsePage(new LoginPage(...);}} ? you´d create it when it is needed then, right? 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--tp19254601p19267162.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]
Re: Going back to a previous URL?
I have also noticed that HybridUrlCodingStrategy.PAGE_PARAMETERS_META_DATA_KEY will ADD my referring page's page parameters to the URL of the target page. While it works, it's not very elegant at all. Perhaps I'm not following your suggestion as you intended? classacts wrote: Hi Uwe, Thanks for your reply, I understand your technique now. However, what about when we do care about URLs? For example, my LoginPageLink class is as follows: @NonAuthOnly private final class LoginPageLink extends BookmarkablePageLink { private static final long serialVersionUID = 1L; public LoginPageLink(String id) { super(id, LoginPage.class); } //@Override //public void onClick() { //LoginPage lp = new LoginPage(); //lp.setReferringPage(BasePage.this.getPage()); //} } Not really quite sure how to create an instance of LoginPage here and still being able to use BookmarkablePageLink... using Link produces nasty href URLs which I don't want on my public-facing home page. The only solution I can come up with now is to use some Link derivative and create the static URL which will be used in the href to make it look nice while being able to override onClick()... Uwe Schäfer wrote: classacts schrieb: 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. so if not using RestartResponseAtInterceptionPage, what you want is to a) move to a nice looking/bookmarkable url for that login page and b) pass the reference to your current page, so that the targeting page can do setResponsePage(myBackPage); this can be complished using HybridUrlCodingStrategy like below. 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. well it is more about passing data directly to the targeted page, but STILL have a nicelooking and bookmarkable URL. Let´s say you would not care about URLs, what you´d do is: class A extend Page{ ... B b = new B(); b.setWhateverStateYouLike(..); b.setMybackPage(this); setResponsePage(b); ... } class B extends Page { ... setMyBackPage(Page back){this.back=back;} ... new Link(back){ void onClick(){ setResponsePage(back); } } ... } the 'problem' here is - for those, who care about urls - the URL you give to B here does not have parameters. with the mentioned b.setMetaData(HybridUrlCodingStrategy.PAGE_PARAMETERS_META_DATA_KEY, new PageParameters(...)) you could add parameters to the URL. That is it. Basically, Page targetPage = new LoginPage(new PageParameters()); (LoginPage doesn't have any parameters) Page targetPage = new BookmarkablePageClass(... well, you don´t need parameters then ;) By following the above implementation, would it not be a tad wasteful creating LoginPage instances every time any BasePage sibling is created? sure, why would you want to do that? what about new Link(bla){onClick(){setResponsePage(new LoginPage(...);}} ? you´d create it when it is needed then, right? 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--tp19254601p19269273.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]
Re: Going back to a previous URL?
classacts schrieb: Not really quite sure how to create an instance of LoginPage here and still being able to use BookmarkablePageLink... just mount it using hybrid, that should be it, right? using Link produces nasty href URLs which I don't want on my public-facing home page. thats the URL in the markup, but when redirecting, you´ll see the nice on in the browser. if this is not sufficient, you might be forced to use bookmarkablepagelinks only, and code your state to parameters or dump it in the session, which is probably not why you chose wicket over any other framework ;) maybe some else has another funky idea how to pass state to a bookmarkable page? cu uwe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Going back to a previous URL?
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]