// UIComponent instances are in the session instead
// of the TreeNode instances. This is a problem
// for servers that persist session data since
// UIComponent instances are not serializable.
VisitContext visitContext = VisitContext.createVisitContext(context);
viewRoot.visitTree(visitContext, new VisitCallback() {
public VisitResult visit(VisitContext context, UIComponent target) {
VisitResult result = VisitResult.ACCEPT;
String cid = target.getClientId(context.getFacesContext());
Object stateObj = state.get(cid);