if (base==null && property.equals("page"))
{
UIViewRoot vr = FacesContext.getCurrentInstance().getViewRoot();
if (vr==null)
{ // Error: No view root
RuntimeException e = new MiscellaneousErrorException("ViewRoot not available. Unable to get Page Bean.");
log.error(e.getMessage());
throw e;
}
Map<String,Object> vmap = vr.getViewMap(false);
Page page = (vmap!=null ? (Page)vmap.get("page") : null);
if (page==null)
{ // Error: No page bean
RuntimeException e = new MiscellaneousErrorException("Page bean not available for current view.");
log.error(e.getMessage());
throw e;
}
context.setPropertyResolved(true);
return page;
}