Thursday, July 16, 2009

Wicket: link/url relative to the context path

I was trying to figure that out and it took me long enough to find how to do that in wicket that it may be worth posting how to solve this problem.


ExternalLink logoutLink = new ExternalLink("logout_link", "/j_spring_security_logout");
logoutLink.setContextRelative(true);
add(logoutLink);


I was integrating Spring Security and wanted to add the logout link. There is no need to figure out the context path, as the ExternalLink class has an option to set the link as relative to the context.

You can find more info here: ExternalLink (javadoc)
Post a Comment