The lifetime of data stored in the context cannot be guaranteed. The context can be released any time when the web server needs resources. We strongly recommend to refresh the stored data (for example, in the JSP DynPage method doProcessAfterInput, which is called every time an event occurs on the web client) to avoid an exception. The exception will occur when you try to access a value that is already gone (or has never been set).
Getting the request object:
IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
To store a value in the session we have to use the command line:
request.getComponentContext().putValue("myText", "A short note in the context");
To get the stored value we have to use the command line:
request.getComponentContext().getValue("myText");
To store a value in the session we have to use the command line:
<%
componentRequest.getComponentContext().putValue("myText", "From the JSP");
%>
To get the stored value we have to use the command line:
<%
componentRequest.getComponentContext().getValue("myText").toString();
%>