Advantage and disadvantage save state in Restore View in client/server JSF 2

phanhongphucit picture phanhongphucit · May 31, 2013 · Viewed 7.6k times · Source

In the Restore View phase of JSF 2, we can config saving state of each components in server or client by

<context-param>
  <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
  <param-value>client</param-value>
</context-param>

I have a question that what is advantage and disadvantage if we save the state in client or server side?
Thanks so much!

Answer

Vikas V picture Vikas V · May 31, 2013

First you must read

To summarize answer to your question,

Client side: Saving state on the client results in less of a load on the server at the expense of additional network traffic. This is because by default, client side is stored as a large hidden <input> field in web browsers. Saving state on the client also works better in failover situations because even if the server is down, the state won't be lost.

State saving at client side is having security concerns as well as overhead of serialization of entire JSF tree every time.

Server side: Prevents CSRF and phishing attacks.