In a JSF/Trinidad application the “state-saving” is configured via some parameters in the web.xml file. Trinidad adds a bit more to it with its TOKEN approach, check the documentation for the “org.apache.myfaces.trinidad.CLIENT_STATE_METHOD” to read more. The result of the configuration via WEB.XML file is that the entire configuration for the state-staving behavior is GLOBAL. In Trinidad most of the time we use a hybrid approach (server+token on client), but sometimes you want a specifc page to be just client-side, to avoid nasty “session expired errors”. A good example would be a login page, to have (client-only) state – of course a totally stateless page would make sense too, but this means a login page is created outside of the (Trinidad/JSF) framework.
We recently introduced a new feature to enable the configuration of the state-saving on a per-page base! For that we introduce a new attribute on the <tr:document> component (stateSaving). The “stateSaving” attribute takes three different values:
- client (force to be (full) client)
- server (force to be server-side)
- default (do what ever the user said in web.xml)
So with this it is possible to tweak the state-saving on a per-page base, instead of all done globally!
Leave a Reply