Re: multiple html pages to 1 class
Thanks... 2010/10/8 Jeremy Thomerson > I forgot to include the URLs you should try in that quickstart: > > http://localhost:8080/example1 > http://localhost:8080/example1?template=red > http://localhost:8080/example2 > http://localhost:8080/example2?template=red > > Here's the link to the quickstart again: > > http://apache-wicket.1842946.n4.nabble.com/file/n2967852/multitemplates.tar.gz > > Best regards, > > -- > Jeremy Thomerson > http://www.wickettraining.com > > On Thu, Oct 7, 2010 at 11:26 PM, jer...@wickettraining.com < > jer...@wickettraining.com> wrote: > > > > > Here is a quickstart that demonstrates two ways of accomplishing this. > > These > > are the ways that were previously suggested on this thread. Please open > it > > and try the following links, and submit the form on each to prove that > the > > HTML template choice is persisted even after "the url becomes unusable": > > > > > > > http://apache-wicket.1842946.n4.nabble.com/file/n2967852/multitemplates.tar.gz > > multitemplates.tar.gz > > > > Jeremy Thomerson > > http://www.wickettraining.com > > -- > > View this message in context: > > > http://apache-wicket.1842946.n4.nabble.com/multiple-html-pages-to-1-class-tp2717304p2967852.html > > Sent from the Users forum 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: multiple html pages to 1 class
I forgot to include the URLs you should try in that quickstart: http://localhost:8080/example1 http://localhost:8080/example1?template=red http://localhost:8080/example2 http://localhost:8080/example2?template=red Here's the link to the quickstart again: http://apache-wicket.1842946.n4.nabble.com/file/n2967852/multitemplates.tar.gz Best regards, -- Jeremy Thomerson http://www.wickettraining.com On Thu, Oct 7, 2010 at 11:26 PM, jer...@wickettraining.com < jer...@wickettraining.com> wrote: > > Here is a quickstart that demonstrates two ways of accomplishing this. > These > are the ways that were previously suggested on this thread. Please open it > and try the following links, and submit the form on each to prove that the > HTML template choice is persisted even after "the url becomes unusable": > > > http://apache-wicket.1842946.n4.nabble.com/file/n2967852/multitemplates.tar.gz > multitemplates.tar.gz > > Jeremy Thomerson > http://www.wickettraining.com > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/multiple-html-pages-to-1-class-tp2717304p2967852.html > Sent from the Users forum 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: multiple html pages to 1 class
Here is a quickstart that demonstrates two ways of accomplishing this. These are the ways that were previously suggested on this thread. Please open it and try the following links, and submit the form on each to prove that the HTML template choice is persisted even after "the url becomes unusable": http://apache-wicket.1842946.n4.nabble.com/file/n2967852/multitemplates.tar.gz multitemplates.tar.gz Jeremy Thomerson http://www.wickettraining.com -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/multiple-html-pages-to-1-class-tp2717304p2967852.html Sent from the Users forum 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: multiple html pages to 1 class
Show us some code... What I suggested should work - you won't lose it after submitting a form, and no form will need to know about it. Something like this: class MyWackyMultiHtmlPage extends WebPage { private final String htmlTemplate; MyWackyMultiHtmlPage(PageParameters pp) { htmlTemplate = pp.getAsString("yourkey"); add(new Form(...) { ...}); } } That htmlTemplate field will be serialized with the page. When the form is submitted, it will be returned to exactly the same instance of the page, with the htmlTemplate variable still in tact. So, if you can get it from the URL the first time (which is what you said you were trying to do), then you save it for all stateful changes of the page. Just use that field in the methods that resolve the markup and cache keys. On Tue, Sep 28, 2010 at 12:34 PM, Alex Rass wrote: > Yeah, smart approach, and I thought about that... > > It's no good because the URL becomes unusable right after. > And I would need custom handling inside each form (or having to sub-class > every form I use). > And hitting reload or moving the tab to another window will most likely > break it in some browsers. > > I even tried applying the QueryStringUrlCodingStrategy but it loses the > page > name as soon as you submit the form. Seems like a bug to me. One that > prevents me from having a nice 1-class handler :( > > HybridUrlCodingStrategy has been used in some hacky tutorials, but you get > the version at the end or the page name which makes everything fall apart. > So I suspect solution is to fix the post form refresh of the url for the > BookmarkablePageRequestTargetUrlCodingStrategy and/or for the > QueryStringUrlCodingStrategy > > Or I am open to other suggestions. > > - Alex Rass > > > -Original Message- > From: Jeremy Thomerson [mailto:jer...@wickettraining.com] > Sent: Tuesday, September 28, 2010 1:00 PM > To: users@wicket.apache.org > Subject: Re: multiple html pages to 1 class > > If you're getting what template to use from the PageParameters, and then > submitting a form, save it in a field in the page when you pull it from the > PageParameters. > > On Tue, Sep 28, 2010 at 11:53 AM, Alex Rass wrote: > > > Thanks, Igor. > > > > That's what I did. > > BUT as soon as I hit form submit - it does a round-trip and loses the > > page part in the URL, and I am down to site.com/?wicket... > > from having a nice site.com/page.html (and using getRequest() to grab > > the page name). > > So I have no way to know which page I am actually on anymore :) > > > > - Alex > > > > > > -Original Message- > > From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] > > Sent: Tuesday, September 28, 2010 11:46 AM > > To: users@wicket.apache.org > > Subject: Re: multiple html pages to 1 class > > > > let your page implement IMarkupResourceStreamProvider and > > IMarkupCacheKeyProvider and return whatever html you want, anything > > will do it as long as it matches component hierarchy. > > > > -igor > > > > On Tue, Sep 28, 2010 at 7:40 AM, Alex Rass wrote: > > > I know this has been raised tons of times, But has anyone ever > > > figured > > > out: how to do this and not screw up page versioning? > > > > > > Any sort of CMS would need this. > > > > > > I am ok with going to 1.5.M2 for this, btw, if that solves it. > > > > > > - Alex. > > > > > > > > > > > > - 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 > > > > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > -- > Jeremy Thomerson > http://www.wickettraining.com > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Jeremy Thomerson http://www.wickettraining.com
RE: multiple html pages to 1 class
Yeah, smart approach, and I thought about that... It's no good because the URL becomes unusable right after. And I would need custom handling inside each form (or having to sub-class every form I use). And hitting reload or moving the tab to another window will most likely break it in some browsers. I even tried applying the QueryStringUrlCodingStrategy but it loses the page name as soon as you submit the form. Seems like a bug to me. One that prevents me from having a nice 1-class handler :( HybridUrlCodingStrategy has been used in some hacky tutorials, but you get the version at the end or the page name which makes everything fall apart. So I suspect solution is to fix the post form refresh of the url for the BookmarkablePageRequestTargetUrlCodingStrategy and/or for the QueryStringUrlCodingStrategy Or I am open to other suggestions. - Alex Rass -Original Message- From: Jeremy Thomerson [mailto:jer...@wickettraining.com] Sent: Tuesday, September 28, 2010 1:00 PM To: users@wicket.apache.org Subject: Re: multiple html pages to 1 class If you're getting what template to use from the PageParameters, and then submitting a form, save it in a field in the page when you pull it from the PageParameters. On Tue, Sep 28, 2010 at 11:53 AM, Alex Rass wrote: > Thanks, Igor. > > That's what I did. > BUT as soon as I hit form submit - it does a round-trip and loses the > page part in the URL, and I am down to site.com/?wicket... > from having a nice site.com/page.html (and using getRequest() to grab > the page name). > So I have no way to know which page I am actually on anymore :) > > - Alex > > > -Original Message- > From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] > Sent: Tuesday, September 28, 2010 11:46 AM > To: users@wicket.apache.org > Subject: Re: multiple html pages to 1 class > > let your page implement IMarkupResourceStreamProvider and > IMarkupCacheKeyProvider and return whatever html you want, anything > will do it as long as it matches component hierarchy. > > -igor > > On Tue, Sep 28, 2010 at 7:40 AM, Alex Rass wrote: > > I know this has been raised tons of times, But has anyone ever > > figured > > out: how to do this and not screw up page versioning? > > > > Any sort of CMS would need this. > > > > I am ok with going to 1.5.M2 for this, btw, if that solves it. > > > > - Alex. > > > > > > > > - 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 > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Jeremy Thomerson http://www.wickettraining.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: multiple html pages to 1 class
If you're getting what template to use from the PageParameters, and then submitting a form, save it in a field in the page when you pull it from the PageParameters. On Tue, Sep 28, 2010 at 11:53 AM, Alex Rass wrote: > Thanks, Igor. > > That's what I did. > BUT as soon as I hit form submit - it does a round-trip and loses the page > part in the URL, and I am down to > site.com/?wicket... > from having a nice site.com/page.html (and using getRequest() to grab the > page name). > So I have no way to know which page I am actually on anymore :) > > - Alex > > > -Original Message- > From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] > Sent: Tuesday, September 28, 2010 11:46 AM > To: users@wicket.apache.org > Subject: Re: multiple html pages to 1 class > > let your page implement IMarkupResourceStreamProvider and > IMarkupCacheKeyProvider and return whatever html you want, anything will do > it as long as it matches component hierarchy. > > -igor > > On Tue, Sep 28, 2010 at 7:40 AM, Alex Rass wrote: > > I know this has been raised tons of times, But has anyone ever figured > > out: how to do this and not screw up page versioning? > > > > Any sort of CMS would need this. > > > > I am ok with going to 1.5.M2 for this, btw, if that solves it. > > > > - Alex. > > > > > > - > > 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 > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Jeremy Thomerson http://www.wickettraining.com
RE: multiple html pages to 1 class
Thanks, Igor. That's what I did. BUT as soon as I hit form submit - it does a round-trip and loses the page part in the URL, and I am down to site.com/?wicket... from having a nice site.com/page.html (and using getRequest() to grab the page name). So I have no way to know which page I am actually on anymore :) - Alex -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Tuesday, September 28, 2010 11:46 AM To: users@wicket.apache.org Subject: Re: multiple html pages to 1 class let your page implement IMarkupResourceStreamProvider and IMarkupCacheKeyProvider and return whatever html you want, anything will do it as long as it matches component hierarchy. -igor On Tue, Sep 28, 2010 at 7:40 AM, Alex Rass wrote: > I know this has been raised tons of times, But has anyone ever figured > out: how to do this and not screw up page versioning? > > Any sort of CMS would need this. > > I am ok with going to 1.5.M2 for this, btw, if that solves it. > > - Alex. > > > - > 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: multiple html pages to 1 class
let your page implement IMarkupResourceStreamProvider and IMarkupCacheKeyProvider and return whatever html you want, anything will do it as long as it matches component hierarchy. -igor On Tue, Sep 28, 2010 at 7:40 AM, Alex Rass wrote: > I know this has been raised tons of times, > But has anyone ever figured out: how to do this and not screw up page > versioning? > > Any sort of CMS would need this. > > I am ok with going to 1.5.M2 for this, btw, if that solves it. > > - Alex. > > > - > 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