Setting session variables with a snippet-based rendering engine function

To create a session variable (when there is no existing function with the same name), a snippet-based rendering engine function is provided.

makeSessionVarIDID(varName, varValue)
In the template itself, you would add this function using a line such as the following:
<input type="hidden" gwc:attributes="name makeSessionVarIDID('var1','value1')" />

When you use this function, the GAS first builds a page with a session variable, however it is not created in the application context yet. When the form is submitted by the User Agent to the GAS, the engine creates the session variable.

Note: Setting a variable to an empty string is equivalent to deleting the variable.