Skip to Content

Retrieving a cookie from session component


Is it possible to retrieve a variable in the java part of a JSPDynPage set with EPCM.storeClientData() in the client part (javascript)?

Normally I’m doing it by using a hidden input field as data container, but I would like to keep the JSP code to a minimum 😊

I have read in some other posts that it should be possible to access the variable through the session component.

I have tried to get it working, but without any luck 😔

So what have I been doing. In the sender iView I have the following Javascript setting the variable and raising an event:


function fireEvent(evtData){

EPCM.storeClientData( 'urn:com.myDomain', 'eventDataBag', evtData);

alert( EPCM._private.printClientDataBag() );

EPCM.raiseEvent( 'urn:com.myDomain', 'eventTest', evtData );



And in the receiver iView I have the following Javascript for reloading the iView.


EPCM.subscribeEvent( 'urn:com.myDomain', 'eventTest', <%=jsFunctionName%> );

function <%=jsFunctionName%> ( evt ) {

alert( EPCM._private.printClientDataBag() );




So far no problem.

Now I want to get the variable from the session component in the doProcessBeforeOutput() method.

public void doProcessBeforeOutput() throws PageException {

IPortalComponentRequest request =

(IPortalComponentRequest) this.getRequest();

IPortalComponentResponse response =

(IPortalComponentResponse) this.getResponse();


"getValue: "

+ request.getComponentSession().getValue("eventDataBag")

+ "<br/>");



I’m not getting any value. What am I doing wrong, is there some thing I have forgotten or is it just not possible?

Best regards,


Add comment
10|10000 characters needed characters exceeded

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jun 04, 2004 at 11:19 AM

    Well, after looking at the EPCM implmentation it normally uses cookies to store the result (unles you are using the java applet level which you normally wouldn't).

    In principle, you could therefore get the values from using the getCookies method in the IPortalComponentRequest (or HttpServletRequest). But, there is no free lunch, and the name of the cookie is probably dynamic and the contents might be a bit altered.

    Try some debug information on the cookies

    Add comment
    10|10000 characters needed characters exceeded