Annotation Type SessionState


  • ()
    
    ()
    @UseWith({COMPONENT,MIXIN,PAGE})
    public @interface SessionState
    Marker annotation for a property that is a session state object (SSO) as controlled by the ApplicationStateManager. An SSO property is stored as global session object (i.e., in the ), accessible to every page or component, but in fact the built-in strategies for SSO management are session-specific, ultimately storing data in the Session.

    For each SSO property, you may declare a companion boolean property that can be checked to see if the SSO has been created yet. The companion boolean property must have the same name as the SSO property but suffixed with "Exists" (e.g., an SSO property named "user" and a companion boolean property named "userExists"). You can access the boolean property to determine whether the SSO has already been created. This mechanism is necessary because even a null check ("user != null") may force the SSO to be created. Instead, check the companion boolean field ("userExists").

    Note: Tapestry 5.0 called these objects "Application State Objects"; thus some of the underlying services have confusing names (e.g., ApplicationStateManager, which really should be SessionStateManager) but can't be renamed for backward compatibility reasons.

    Since:
    5.1.0.4
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean create
      If true (the default), then referencing an field marked with the annotation will create the SSO.
    • Element Detail

      • create

        boolean create
        If true (the default), then referencing an field marked with the annotation will create the SSO. If false, then accessing the field will not create the SSO, it will only allow access to it if it already exists.
        Default:
        true