code: private void restoreDescendantState(UIComponent component,
                                          FacesContext context) {
  
          // Reset the client identifier for this component
          String id = component.getId();
          component.setId(id); // Forces client id to be reset
          Map<String, SavedState> saved = (Map<String,SavedState>)
              getStateHelper().get(PropertyKeys.saved);
          // Restore state for this component (if it is a EditableValueHolder)
          if (component instanceof EditableValueHolder) {
              EditableValueHolder input = (EditableValueHolder) component;
              String clientId = component.getClientId(context);
  
              SavedState state = (saved == null ? null : saved.get(clientId));
              if (state == null) {
                  input.resetValue();
              } else {
                  input.setValue(state.getValue());
                  input.setValid(state.isValid());
                  input.setSubmittedValue(state.getSubmittedValue());
                  // This *must* be set after the call to setValue(), since
                  // calling setValue() always resets "localValueSet" to true.
                  input.setLocalValueSet(state.isLocalValueSet());
              }
          } else if (component instanceof UIForm) {
              UIForm form = (UIForm) component;
              String clientId = component.getClientId(context);
              SavedState state = (saved == null ? null : saved.get(clientId));
              if (state == null) {
                  // submitted is transient state
                  form.setSubmitted(false);
              } else {
                  form.setSubmitted(state.getSubmitted());
              }
          }
  
          // Restore state for children of this component
          if (component.getChildCount() > 0) {
              for (UIComponent kid : component.getChildren()) {
                  restoreDescendantState(kid, context);
              }
          }
  
          // Restore state for facets of this component
          if (component.getFacetCount() > 0) {
              for (UIComponent facet : component.getFacets().values()) {
                  restoreDescendantState(facet, context);
              }
          }
  
      }
docs: <p>Restore state information for the specified component and its
  descendants.</p>
  
  @param component Component for which to restore state information
  @param context   {@link FacesContext} for the current request