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: [email protected]
>> 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]