code: private void renderState(FacesContext context) throws IOException {
  		// Get the view state and write it to the response..
  		PartialViewContext pvc = context.getPartialViewContext();
  		PartialResponseWriter writer = pvc.getPartialResponseWriter();
  		String viewStateId = Util.getViewStateId(context);
  
  		writer.startUpdate(viewStateId);
  		String state = context.getApplication().getStateManager().getViewState(context);
  		writer.write(state);
  		writer.endUpdate();
  
  		ClientWindow window = context.getExternalContext().getClientWindow();
  		if (null != window) {
  			String clientWindowId = Util.getClientWindowId(context);
  			writer.startUpdate(clientWindowId);
  			writer.write(window.getId());
  			writer.endUpdate();
  		}
  	}
docs: Copied from com.sun.faces.context.PartialViewContextImpl. May have to be adapted to future Mojarra or JSF versions.