Skip to main content

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

Posted by mriem on February 12, 2014 at 10:21 AM PST

Note this blog is obsolete, see for the current blog

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-name> com.sun.faces.compressViewState</param-name>
        <param-value>false | true</param-value>

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

And that is it.


Related Topics >>