2012-12-28 33 views

回答

0

檢查下面的代碼可以幫助你,

public void beforePhase(PhaseEvent e) 
{ 
try 
    { 
    //if something doesn't work here 

    } 
    catch(Exception e) 
    { 
    System.out.println("Exception ocurred in beforePhase method"); 
    FacesContext context = FacesContext.getCurrentInstance(); 
      ExternalContext externalContext = context.getExternalContext(); 
      UIViewRoot newPage = context.getApplication().getViewHandler().createView(context,"/pages/techErrorPage.jsf"); 
      context.setViewRoot(newPage); 
      context.renderResponse(); 
    } 
} 
相關問題