Interacting with the session object
In this topic ...
Retrieving Objects from the Session
Removing Objects from the Session
Related Topics ...
Storing Objects in Session
We can store objects in the session by setting attributes on the session and specifying the value for those attributes as the objects that you want to share between models. For example, if you wanted to share the value of a variable, "companyname" with another model, you would use code similar to the following:
webAppAccess.getHttpServletRequest().getSession().put("companyname", webAppAccess.getVariables().getText("companyname"));
Retrieving Objects from the Session
To get objects out of the session for use in the current model, call the get method on the Session object. For example, to retrieve the company name stored by the code in the "Storing Objects in Session" section, implement code similar to the following:
String companyName = webAppAccess.getHttpServletRequest().getSession().get("companyname");
Removing Objects from the Session
To remove objects from the session, call the remove method on the Session object. For example, to remove the "company_name" session attribute created by the code in the "Storing Objects in Session" section, implement code similar to the following:
webAppAccess.getHttpServletRequest().getSession().remove("companyname");