The lifetime of data stored in the request is limited to the request only. You have 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).
JSP DynPage
Getting the request object:
IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
To store a value in the session we have to use the command line:
request.getNode().putValue("myText", "A short note in the request");
To get the stored value we have to use the command line:
request.getNode().getValue("myText");
JSP
To store a value in the session we have to use the command line:
<%
componentRequest.getNode().putValue("myText", "That is from the JSP");
%>
To get the stored value we have to use the command line:
<%
componentRequest.getNode().getValue("myText").toString();
%>