diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/FlowViewStateManager.java b/spring-faces/src/main/java/org/springframework/faces/webflow/FlowViewStateManager.java index f63eac5e..4d9e15d1 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/FlowViewStateManager.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/FlowViewStateManager.java @@ -104,10 +104,9 @@ public class FlowViewStateManager extends StateManager { public void writeState(FacesContext context, javax.faces.application.StateManager.SerializedView state) throws IOException { - if (!JsfUtils.isFlowRequest()) { - delegate.writeState(context, state); - } - // nothing to do, as saving state to client always returns false + // Ensures that javax.faces.ViewState hidden field always gets written - needed for third-party component + // compatability + delegate.writeState(context, state); } public boolean isSavingStateInClient(FacesContext context) { diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/TreeStructureManager.java b/spring-faces/src/main/java/org/springframework/faces/webflow/TreeStructureManager.java index c80ee15d..853c508c 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/TreeStructureManager.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/TreeStructureManager.java @@ -1,12 +1,12 @@ /* - * Copyright 2004 The Apache Software Foundation. - * + * Copyright 2004-2008 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,10 +27,15 @@ import javax.faces.component.UIViewRoot; import org.springframework.beans.BeanUtils; import org.springframework.util.ClassUtils; +import org.springframework.webflow.execution.RequestContextHolder; /** - * @author Manfred Geiler (latest modification by $Author: dennisbyrne $) - * @version $Revision: 511715 $ $Date: 2007-02-26 05:05:36 +0100 (Mo, 26 Feb 2007) $ + * Helper class for building and restoring the structure of the JSF component tree. + * + * Largely based on MyFaces implementation, with minor changes for Spring Web Flow's state saving strategy. + * + * @author Jeremy Grelle + * @author Manfred Geiler */ class TreeStructureManager { public Serializable buildTreeStructureToSave(UIViewRoot viewRoot) { @@ -123,39 +128,48 @@ class TreeStructureManager { public static class TreeStructComponent implements Serializable { private static final long serialVersionUID = 5069109074684737231L; - private String _componentClass; - private String _componentId; - private TreeStructComponent[] _children = null; // Array of children - private Object[] _facets = null; // Array of Array-tuples with Facetname and TreeStructComponent + private String componentClass; + private String componentId; + private TreeStructComponent[] children = null; // Array of children + private Object[] facets = null; // Array of Array-tuples with Facetname and TreeStructComponent TreeStructComponent(String componentClass, String componentId) { - _componentClass = componentClass; - _componentId = componentId; + this.componentClass = componentClass; + this.componentId = componentId; } public String getComponentClass() { - return _componentClass; + return componentClass; } public String getComponentId() { - return _componentId; + return componentId; } void setChildren(TreeStructComponent[] children) { - _children = children; + this.children = children; } TreeStructComponent[] getChildren() { - return _children; + return children; } Object[] getFacets() { - return _facets; + return facets; } void setFacets(Object[] facets) { - _facets = facets; + this.facets = facets; } + + public String toString() { + if (JsfUtils.isFlowRequest()) { + return RequestContextHolder.getRequestContext().getFlowExecutionContext().getKey().toString(); + } else { + return super.toString(); + } + } + } }