Skip to Content
0
Former Member
Aug 11, 2005 at 08:28 AM

http session that's driving me crazy

30 Views

Hi,

I have a very basic issue. I try to store data from a JSPDynpage to the httpSession, which is read by a jsp.

I can set data in the http Session object from an AbstractPortalComponent, but setting the session object from a JSPDynpage is not working. In the example below, the JSP shows "no data from http session". Who can help me with this:

<b>Dynpage:</b>

    public void doInitialization(){
		IPortalComponentRequest componentRequest = ((IPortalComponentRequest)getRequest());
		IPortalComponentSession componentSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
		componentSession.getHttpSession().setAttribute("myData","data stored in http session by dynpage");

    }

<b>JSP:</b>

<% 
Object o =  componentRequest.getComponentSession().getHttpSession().getValue("myData");
String data = "no data from http session" ;
if (!(o==null)) data = o.toString();
%>


	<%=data %>