Wicket: how to redirect to another page?

后端 未结 5 1877
花落未央
花落未央 2020-12-24 02:36

How do I redirect to another page using Wicket? IIRC, some exception has to be thrown in the constructor, but I don\'t remember which one. Thanks in advance.

5条回答
  •  清歌不尽
    2020-12-24 03:34

    A quick search for all *Exception.java files in wicket revealed it. One has to throw a RestartResponseAtInterceptPageException:

    public MyPage() {
       ...
       if (redirect) {
           throw new RestartResponseAtInterceptPageException(targetPage);
       }
       ...
    }
    

提交回复
热议问题