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]