public static String calculateViewId ( FacesContext context ) { Map < String , Object > requestMap = context . getExternalContext ( ) . getRequestMap ( ) ; String viewId = ( String ) requestMap . get ( "javax.servlet.include.path_info" ) ; if ( viewId == null ) { viewId = context . getExternalContext ( ) . getRequestPathInfo ( ) ; } if ( viewId == null ) { viewId = ( String ) requestMap . get ( "javax.servlet.include.servlet_path" ) ; } if ( viewId == null ) { viewId = context . getExternalContext ( ) . getRequestServletPath ( ) ; } return viewId ; }
Calculates the current viewId - we can t get it from the ViewRoot if it s not available .