The session object

The session object represents an http session.


clear

Clears all data in the user session.

Syntax:

clear()

Example:

This code clears all data in the user session:

${session.clear()}

destroy

Destroys the user session.

Syntax:

destroy()

Example:

This code destroys the user session:

${session.destroy()}

[property name]

Returns the session data object associated with a specified property name. If a new property name is used, the session data object is created.

Syntax:

[property name] → session data object

Returns:

The session data value associated to a specified property name.

Example:

Here are some examples of how to obtain session data values:

<#assign pref = session.preferences>
<#assign lang = session.preferences.lang>
<#assign theme = session.preferences.theme>
<#assign themeName = session.preferences.theme["name"]>