Client State Saving Method
I am unable to get theclient[\b] State Saving MEthod to work as I understand it should.
Having added
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
to the web.xml I expected the managed beans (which are all serializable) to be serialized to the client.
The expected hidden field containing a length on base64 (or whatever) appears in the rendered HTML.
However when testing it appears that the managed beans are not stored on the client.
1. When running in a multiple server environment through a round-robin load balancer the state is lost.
2. When restarting the application server where the sessions are not persisted to the file system the state is lost.
3. When debugging the application in the application server the instances of the managed beans remeain the same through requests; they have not been serialized and deserialized.
So why is the state not being stored on the client and acting as though the STATE_SAVING_METHOD setting is 'server'?
I am running Tomcat 4.1.24 and have tried JSF RI 1.1_01 and MyFaces 1.1.3.
Any help would be gratefully received.
[1281 byte] By [
Hyperiona] at [2007-10-3 2:30:05]

For the managed beans, "application" scope obviously MUST be stored on the server, and "request" scope doesn't get saved beyond the request anyway. Only "session" scope would be relevant, but that is defined to use the standard servlet session context methods.
I could imagine an enhancement where a "client" scope bean was saved on the client side if the "STATE_SAVING_METHOD" was "client".
Meanwhile, you can save basic state objects on the client side by adding "h:inputHidden" tags to your forms, and binding the values to the bean properties you want saved.
If you need more complicated objects saved on the client side, you can make them part of the "component state":
* Creating a custom component (perhaps extending the HtmlInputHidden component) where you override the "restoreState" and "saveState" methods would let you do this.
* Without creating a custom component, but using "f:attribute" inside a standard component tag might work too -- it will certainly save the state, but I'm not sure if it will be reapplied to the bean when the component is restored.
Apart from all that, if you are concerned with saving state on the client, and saving bandwidth, you probably should look at the various "AJAX" implementations (including JSF based ones).