Class SessionMap

  • All Implemented Interfaces:
    Map<String,​Object>

    public class SessionMap
    extends Object
    implements Map<String,​Object>
    Provides a Map adaptor for HttpSession objects. A SessionMap instance is available in each Velocity page using the name "session".

    For example suppose we have a User object in the session with the attribute name "user" when a user is logged on. We can display the users name in the page when the are logged onto the system.

     #if ($session.user)
       $session.user.fullname you are logged on.
     #else
       You are not logged on.
     #end 
    The ClickServlet adds a SessionMap instance to the Velocity Context before it is merged with the page template.

    The SessionMap supports FlashAttribute which when accessed via get(Object) are removed from the session.