fallback links do this:

generate normal HREF for non-ajax (or JS disabled) requests

add an "onclick" handler that handles the request via AJAX if possible, and
then returns false if JS was enabled.  this causes the normal HREF url to
never be visited.

hope this helps.

-- 
Jeremy Thomerson
http://www.wickettraining.com

On Mon, Oct 6, 2008 at 2:59 AM, Liz Huber <[EMAIL PROTECTED]> wrote:

> >That is the intention, the fallback links only work when javascript is
> enabled.
>
> According to the book "wicket in action" the intention of a fallback link
> is, that it acts like a usual link, if java script is disabled. Or did I
> get this wrong?
>
>
>
> > I think you should mount your pages like this:
> > mount(new HybridUrlCodingStrategy("home/project", ProjectPage.class));
> > mount(new HybridUrlCodingStrategy("home/team", TeamPage.class));
>
> This would be great, but I can't do this, because "project" and "team"
> aren't single pages.
>
> Once, panel "project" is displayed in page "home" and once panel "team" is
> shown (depending on what the user selected in menu).
>
> Each panel has its own class, but only page classes can be mounted.
>
>
>
> Does anyone still have an idea?
>
> Liz
>
>
>
>
>
> > ----- Original Message -----
> > From: Erik van Oosten
> > Sent: 09/26/08 04:29 pm
> > To: users@wicket.apache.org
> > Subject: Re: Nice urls in markup
> >
> > Liz,
> > > The "href"-Element of my Ajax-Fallbacklinks show a pretty URLs now, but
> > the
> > > fallback links don't work anymore, if JavaScript is disabled.
> > >
> > That is the intention, the fallback links only work when havascript is
> > enabled.
> >
> > I think you should mount your pages like this:
> > mount(new HybridUrlCodingStrategy("home/project", ProjectPage.class));
> > mount(new HybridUrlCodingStrategy("home/team", TeamPage.class));
> >
> > Regards,
> >     Erik.
> >
> >
> > Liz Huber wrote:
> > > First of all: Thanks a lot for trying to help me, Erik!
> > >
> > > The "href"-Element of my Ajax-Fallbacklinks show a pretty URLs now, but
> > the
> > > fallback links don't work anymore, if JavaScript is disabled.
> > > <ul>
> > >    <li><a href="home" id="navMail__itema" onclick="var
> > >
> >
> wcall=wicketAjaxGet('?wicket:interface=:0:panelMiddleNavigation:navMail:0:navMail_item::IBehaviorListener:0:',null,null,
> > > function() {return Wicket.$('navMail__itema') !=
> > null;}.bind(this));return
> > > !wcall;"><span>Products</span></a></li>
> > > </ul>
> > > <ul>
> > >    <li><a href="home" id="navMail__itemb" onclick="var
> > >
> >
> wcall=wicketAjaxGet('?wicket:interface=:0:panelMiddleNavigation:navMail:1:navMail_item::IBehaviorListener:0:',null,null,
> > > function() {return Wicket.$('navMail__itemb') !=
> > null;}.bind(this));return
> > > !wcall;"><span>Team</span></a></li>
> > > </ul>
> > >
> > > The thing I'd like to do is to mount a different, meaningful URLs for
> > each
> > > Ajax-Fallbacklink. This URL should be shown in markup and within the
> > > address line of the browser. And of course, the link should work
> > > afterwards:
> > > <ul>
> > >    <li><a href="home/products" id="navMail__itema" onclick="var
> > >
> >
> wcall=wicketAjaxGet('?wicket:interface=:0:panelMiddleNavigation:navMail:0:navMail_item::IBehaviorListener:0:',null,null,
> > > function() {return Wicket.$('navMail__itema') !=
> > null;}.bind(this));return
> > > !wcall;"><span>Products</span></a></li>
> > > </ul>
> > > <ul>
> > >    <li><a href="home/team" id="navMail__itemb" onclick="var
> > >
> >
> wcall=wicketAjaxGet('?wicket:interface=:0:panelMiddleNavigation:navMail:1:navMail_item::IBehaviorListener:0:',null,null,
> > > function() {return Wicket.$('navMail__itemb') !=
> > null;}.bind(this));return
> > > !wcall;"><span>Team</span></a></li>
> > > </ul>
> > >
> > > I've been wondering, if it is even possible to do that. Could anyone
> > try to
> > > help, please?
> > >
> > > Thanks,
> > > Liz
> > >
> > >
> > >
> > >
> > >
> > >> ----- Original Message -----
> > >> From: Erik van Oosten
> > >> Sent: 25/09/08 02:39 pm
> > >> To: users@wicket.apache.org
> > >> Subject: Re: Nice urls in markup
> > >>
> > >> Use a HybridUrlCodingStrategy to mount your pages. This will make ajax
> > >> request link to a similar URL as the page your are mounting (it adds a
> > >> number).
> > >>
> > >> Regards,
> > >>     Erik.
> > >>
> > >> Liz Huber wrote:
> > >>
> > >>> I'm trying to beautify all wicket urls of my application by mounting
> > >>>
> > >> the
> > >>
> > >>> pages to meaningful paths.
> > >>> Thereby the urls become pretty in the browser's address line.
> > >>>
> > >>> But within the rendered markup links and images still have non
> > formated
> > >>> wicket urls.
> > >>> So I mounted the images as shared resources and successfully tricked
> > by
> > >>> overwriting methode onComponentTag():
> > >>>
> > >>> @Override
> > >>> protected void onComponentTag(ComponentTag tag)
> > >>> {
> > >>>     super.onComponentTag(tag);
> > >>>     tag.put("src", urlFor(getImageResourceReference()).toString());
> > >>> }
> > >>>
> > >>> The same way I proceeded concerning links: I mounted the referenced
> > >>>
> > >> page
> > >>
> > >>> and overwrote methode onComponentTag():
> > >>>
> > >>> @Override
> > >>> protected void onComponentTag(ComponentTag tag) {
> > >>>     super.onComponentTag(tag);
> > >>>     if (clazz != null) {
> > >>>         tag.put("href", urlFor(clazz, null)); //where clazz =
> > >>> Class.forName(getDefaultModelObjectAsString());
> > >>>     } else {
> > >>>         tag.remove("href");
> > >>>     }
> > >>> }
> > >>>
> > >>> This works pretty well and the urls in markup look like the
> > mountpaths.
> > >>>
> > >> But
> > >>
> > >>> one problem is still remaining. I created a list containing ajax
> > >>>
> > >> fallback
> > >>
> > >>> links. In markup they contain a "href" attribute, which is probably
> > >>>
> > >> used,
> > >>
> > >>> when java script is deactivated.
> > >>>
> > >>> ...<ul>
> > >>>    <li><a
> > >>>
> > >>>
> > >>
> >
> href="?wicket:interface=:0:panelMiddleNavigation:navMail:0:navMail_item::ILinkListener::"
> > >>
> > >>> id="navMail__itema" onclick="var
> > >>>
> > >>>
> > >>
> >
> wcall=wicketAjaxGet('?wicket:interface=:0:panelMiddleNavigation:navMail:0:navMail_item::IBehaviorListener:0:',null,null,
> > >>
> > >>> function() {return Wicket.$('navMail__itema') !=
> > >>>
> > >> null;}.bind(this));return
> > >>
> > >>> !wcall;"><span>AjaxLink 1</span></a></li>
> > >>> </ul>
> > >>> <ul>
> > >>>    <li><a
> > >>>
> > >>>
> > >>
> >
> href="?wicket:interface=:0:panelMiddleNavigation:navMail:1:navMail_item::ILinkListener::"
> > >>
> > >>> id="navMail__itemb" onclick="var
> > >>>
> > >>>
> > >>
> >
> wcall=wicketAjaxGet('?wicket:interface=:0:panelMiddleNavigation:navMail:1:navMail_item::IBehaviorListener:0:',null,null,
> > >>
> > >>> function() {return Wicket.$('navMail__itemb') !=
> > >>>
> > >> null;}.bind(this));return
> > >>
> > >>> !wcall;"><span>AjaxLink 2</span></a></li>
> > >>> </ul>...
> > >>>
> > >>> I'd like to formate this url as well but I don't know how. I've
> > already
> > >>> tried to mount Pages with parameters and to overwrite the "href" in
> > the
> > >>> onComponentTag() methode. But it didn't help!
> > >>> Could you please give me a clue!
> > >>>
> > >>> Thanks,
> > >>> Liz
> > >>>
> > >>>
> > >>>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >> For additional commands, e-mail: [EMAIL PROTECTED]
> > >>
> > >>
> > >
> > >
> >
> > --
> >
> > --
> > Erik van Oosten
> > http://day-to-day-stuff.blogspot.com/
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>

Reply via email to