Index: icefaces/core/src/main/java/org/icefaces/impl/context/DOMPartialViewContext.java =================================================================== --- icefaces/core/src/main/java/org/icefaces/impl/context/DOMPartialViewContext.java (revision 59) +++ icefaces/core/src/main/java/org/icefaces/impl/context/DOMPartialViewContext.java (working copy) @@ -276,9 +276,9 @@ writer.saveOldDocument(); } - renderState(); + final String viewState = renderState(); renderExtensions(); - renderFixViewState(); + renderFixViewState(viewState); runScripts(); partialWriter.endDocument(); @@ -637,7 +637,7 @@ * * @throws IOException */ - private void renderFixViewState() throws IOException { + private void renderFixViewState(String viewState) throws IOException { //See if any form ids were recorded that need their ViewState fixed Map facesMap = facesContext.getAttributes(); @@ -647,7 +647,6 @@ return; } - String viewState = facesContext.getApplication().getStateManager().getViewState(facesContext); String escapedViewState = escapeJSString(viewState); //Build an array of the form ids to be passed into the appropriate client function @@ -696,7 +695,7 @@ } - private void renderState() throws IOException { + private String renderState() throws IOException { Map facesMap = facesContext.getAttributes(); PartialResponseWriter writer = getPartialResponseWriter(); String viewState = facesContext.getApplication().getStateManager().getViewState(facesContext); @@ -718,6 +717,7 @@ writer.write(viewState); writer.endUpdate(); } + return viewState; } protected void renderExtensions() {