HTML and CSS Reference
One of the useful features of JSF 2.2 is the ability to create stateless views. Creating stateless views has two main advantages:
Stateless view has a better performance than the default stateful view, because no time is
spent for saving and restoring the state of the dynamic components inside <h:form> .
<h:form> ), because
no memory is consumed for saving the state of the dynamic components inside <h:form> .
Stateless view consumes less memory than the default stateful view (with
Although both the performance and memory gains can be relatively small for small and medium pages, this gain
can be significant when you have large pages with many components in your application and also when your JSF
application has a lot of concurrent users with limited hardware capabilities; this means that stateless views can serve
for making JSF applications more scalable.
Stateless views is one of the most powerful options if you are seeking to develop public web sites using JSF.
Because stateless views do not have state, it is important to realize that they will not work with both view and
session scoped beans; this means that you should be aware that your managed beans are set in request scope.
■ Stateless view may not be compatible with JSF component libraries such as primeFaces or richFaces.
So, generally, you have to verify whether the JSF component you are using is working well in stateless mode.
In order to apply stateless behavior to your JSF view, you need to set transient attribute of <f:view> to true as
shown in the following.
<?xml version='1.0' encoding='UTF-8' ?>
<f:view xmlns=" http://www.w3.org/1999/xhtml "
xmlns:f=" http://xmlns.jcp.org/jsf/core "
xmlns:h=" http://xmlns.jcp.org/jsf/html "
<!-- JSF HTML components -->
This is all what you need to do in order to make your JSF view stateless.
Search WWH ::