How can I get the responsePage from a RequestCycle in Wicket 1.5?

二次信任 提交于 2019-12-12 15:02:25

问题


In Wicket 1.4 I used my own WebRequestCycle to store the page in the session when it was detached - in order to implement a 'back' link.

getRequestCycleListeners().add(new AbstractRequestCycleListener() {
    @Override public void onDetach(RequestCycle cycle) {
        squirrelAwayPreviousPage(cycle);
    }
    private void squirrelAwayPreviousPage(RequestCycle cycle) {
        Page responsePage = cycle.getResponse();
        if (responsePage != null)
            ((MySession) getSession()).setPreviousPage(responsePage);
    }
}); 

Now in Wicket 1.5 WebRequestCycle has gone, and I'm supposed to use a RequestCycleListener in its place.

getRequestCycleListeners().add(new AbstractRequestCycleListener() {
    @Override public void onDetach(RequestCycle cycle) {
        squirrelAwayPreviousPage(cycle);
    }
    private void squirrelAwayPreviousPage(RequestCycle cycle) {
        Page responsePage = **cycle.getResponsePage()**;
        if (responsePage != null)
            ((MySession) getSession()).setPreviousPage(responsePage);
    }
});

But RequestCycle doesn't have a getReponsePage(). Where can I find this information?


回答1:


See the migration guide:

https://cwiki.apache.org/confluence/display/WICKET/RequestCycle+in+Wicket+1.5 (Tracking requested and response pages)



来源:https://stackoverflow.com/questions/8129965/how-can-i-get-the-responsepage-from-a-requestcycle-in-wicket-1-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!