With wicket 6.18.0 and Java 8. I have a simple wicket panel:
<!DOCTYPE HTML>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<wicket:container wicket:id="editSection">
<div class="item"><a wicket:id="edit"><wicket:message key="edit" /></a</div>
</wicket:container>
</wicket:panel>
</html>
And in my webpage I have something like that:
public class MainPage extends WebPage {
public MaintPage() {
WebMarkupContainer edit = new WebMarkupContainer("editSection");
edit.add(new AjaxHashLink("edit", "edit"));
add(edit.setVisible(true));
}
}
But on the url I have #edit
at the end of the page when I click on my edit link due certain to the AjaxHashLink
.
But I would like it to be /edit
, but so I am thinking there's something that can be done to modify the href
of the link.
If it's to route to an external resource, you may use the RedirectToUrlException in this case which
Causes Wicket to interrupt current request processing and send a redirect to the given url. Use this if you want to redirect to an external or none Wicket url. If you want to redirect to a page use the RestartResponseException
You could use RequestCycle to get help resolve the url of the current wicket page and throw the exception:
throw new RedirectToUrlException(currentUrl + "#edit");