We're having trouble implementing a page that prevents the user from
navigating away after data has changed on the page without saving. To do
this, we've extended WebRequestCycle with the following:

public class CustomRequestCycle extends WebRequestCycle {

  protected void onBeginRequest() {
    ApplicationSession applicationSession = (ApplicationSession)
getWebSession();       // Our custom Session
    if (applicationSession.hasUnsavedData()) {                      //
Components on the page sets this value
      applicationSession.setUnsavedData(false);

      Page page = (Page) applicationSession.getPageMaps().get(0);    //
Trying to get the last page here, how do we do this?
      onRuntimeException(page, new DomainException("unsaved.data.message"));
    }
  }

}

We can't seem to get the last page out of the PageMap so we can return to
it. Are we doing this right, or is there some other way to do this?

Thanks,
Andre

Reply via email to