0
votes

is there a way to control and interrupt the Page-flow in wicket? Here is an example, what I want to do:

If have a application with 20 pages. Some of these pages are available via central navigation links. Other pages are only available via links in other pages. If someone clicks on a link or uses the browser back button, I want to call a method in my current page, befor accessing the new page. Ideally these method has the ability, to interrupt the page-flow an my application stays on the page, where the link was pressed. I don't want to do this with javascript. I believe, there are possibilities in wicket, but I don't know where. :-)

Regards Jens

2

2 Answers

0
votes

You can easily control the flow page from Wicket, just add a link/button component. For example:

In your HTML:

<a href="#" wicket:id="yourLink">Go somewhere</a>

Your associate java:

add(new Link<Void>("yourLink") {
  @Override
  public void onClick() {
    // Do whatever you need and decide the target page
    setResponsePage(YourDesiredPage.class);
  }
});