int loops = 0;
int maxLoops = 15;
if (facesContext.getViewRoot() == null)
{
throw new ViewNotFoundException("A view is required to execute "+facesContext.getCurrentPhaseId());
}
try
{
// do-while, because the view might change in PreRenderViewEvent-listeners