问题
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