code: public static String getViewStateId(FacesContext context) {
  		String result = null;
  		final String viewStateCounterKey = "com.sun.faces.util.ViewStateCounterKey";
  		Map<Object, Object> contextAttrs = context.getAttributes();
  		Integer counter = (Integer) contextAttrs.get(viewStateCounterKey);
  		if (null == counter) {
  			counter = Integer.valueOf(0);
  		}
  
  		char sep = UINamingContainer.getSeparatorChar(context);
  		UIViewRoot root = context.getViewRoot();
  		result = root.getContainerClientId(context) + sep + ResponseStateManager.VIEW_STATE_PARAM + sep + +counter;
  		contextAttrs.put(viewStateCounterKey, ++counter);
  
  		return result;
  	}
docs: Copied from com.sun.faces.util.Util, Mojarra 2.2.7