JSF Tip #33 - Stateless JSF

In a previous blog entry I blogged about stateless JSF before, this time I will include the entire page so you can see how silly simple it actually is. And you can also go directly to Subversion to get the sample there.

The entirely stateless page


    <?xml version='1.0' encoding='UTF-8'?>

    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core">
        <f:view transient="true">
            <h:head>
                <title>Stateless</title>
            </h:head>
            <h:body>
                <h:form>
                    <p>
                        This is completely (view-)stateless.
                    </p>
                    <h:commandButton value="Submit"/>
                </h:form>
            </h:body>
        </f:view>
    </html>
        

As you can see you can use a form and a commandButton. It will still do a post back it just will not cache the Facelets page so it will rebuild it every time.

Posted November 6, 2013

Up