JSF Tip #60 - What does 'com.sun.faces.compressViewState' do?

In every JSF application view state is kept either on the client or on the server. How do you make sure this state is smaller?

The 'com.sun.faces.compressViewState' comes in handy here. It makes it so that the Mojarra runtime will Gzip compress the view state. Note the context-param is set by default to true, so only if you want to turn it off you will need to do something.

In your web.xml file this would look like the snippet below

        <param-value>false | true</param-value>

Note the value is either "true" or "false"

Posted February 12, 2014