protected void SaveStateInClient(FacesContext facesContext, StateManager.SerializedView serializedView) { //UIViewRoot uiViewRoot = facesContext.getViewRoot (); ////save state in response (client-side: full state; server-side: sequence) //RenderKit renderKit = RenderKitFactory.getRenderKit (facesContext, uiViewRoot.getRenderKitId ()); //// not us. //renderKit.getResponseStateManager ().writeState (facesContext, serializedView); java.io.ByteArrayOutputStream bytearrayoutputstream = new java.io.ByteArrayOutputStream(); java.io.ObjectOutputStream objectoutputstream = new java.io.ObjectOutputStream(bytearrayoutputstream); //ignore tree structure //objectoutputstream.writeObject (serializedView.getStructure ()); objectoutputstream.writeObject(serializedView.getState()); objectoutputstream.close(); bytearrayoutputstream.close(); string s = @"<div> <input type=""hidden"" name=""" + VIEWSTATE + "\" id=\"" + VIEWSTATE + "\" value=\"" + Convert.ToBase64String((byte [])vmw.common.TypeUtils.ToByteArray(bytearrayoutputstream.toByteArray())) + @""" /> </div>"; facesContext.getResponseWriter().write(s); }
protected void SaveStateInClient (FacesContext facesContext, StateManager.SerializedView serializedView) { //UIViewRoot uiViewRoot = facesContext.getViewRoot (); ////save state in response (client-side: full state; server-side: sequence) //RenderKit renderKit = RenderKitFactory.getRenderKit (facesContext, uiViewRoot.getRenderKitId ()); //// not us. //renderKit.getResponseStateManager ().writeState (facesContext, serializedView); java.io.ByteArrayOutputStream bytearrayoutputstream = new java.io.ByteArrayOutputStream (); java.io.ObjectOutputStream objectoutputstream = new java.io.ObjectOutputStream (bytearrayoutputstream); //ignore tree structure //objectoutputstream.writeObject (serializedView.getStructure ()); objectoutputstream.writeObject (serializedView.getState ()); objectoutputstream.close (); bytearrayoutputstream.close (); string s = @"<div> <input type=""hidden"" name=""" + VIEWSTATE + "\" id=\"" + VIEWSTATE + "\" value=\"" + Convert.ToBase64String ((byte []) vmw.common.TypeUtils.ToByteArray (bytearrayoutputstream.toByteArray ())) + @""" /> </div>"; facesContext.getResponseWriter ().write (s); }