[Portal Express 6] Value of attribute in session always null intheme JSP - Websphere

This is a discussion on [Portal Express 6] Value of attribute in session always null intheme JSP - Websphere ; Hi, I try to have access to an attribute in session in my theme (Default.jsp), but the value in always null. I put this attribute in a portlet (standard API, GenericPortlet) : request.getPortletSession().setAttribute("noRedirectContrat", "true", javax.portlet.PortletSession.APPLICATION_SCOPE); request.getPortletSession().setAttribute("noRedirectContrat2", "true", javax.portlet.PortletSession.PORTLET_SCOPE); request.getPortletSession().setAttribute("noRedirectContrat3", "true"); ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: [Portal Express 6] Value of attribute in session always null intheme JSP

  1. [Portal Express 6] Value of attribute in session always null intheme JSP

    Hi,



    I try to have access to an attribute in session in my theme (Default.jsp), but the value in always null.



    I put this attribute in a portlet (standard API, GenericPortlet) :

    request.getPortletSession().setAttribute("noRedirectContrat", "true", javax.portlet.PortletSession.APPLICATION_SCOPE);

    request.getPortletSession().setAttribute("noRedirectContrat2", "true", javax.portlet.PortletSession.PORTLET_SCOPE);

    request.getPortletSession().setAttribute("noRedirectContrat3", "true");



    And in my Default.jsp :







    The values are always null.



    What could be the reason ? Is there something else to activate ?



    The user is logged and I did'nt touch the public.session (which is only for unauthentified session right ?)



    Thanks for your help.

  2. Re: [Portal Express 6] Value of attribute in session always null intheme JSP

    the problem is that the session in the portlet and the session in the theme are different sessions. They are not shared as they are separate web applications



    you would need to do something like the following

    http://www-128.ibm.com/developerwork...02_hepper.html



    IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0

    IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0



    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

  3. Re: [Portal Express 6] Value of attribute in session always null intheme J

    Hi, thanks for your quick answer.



    I use your URL and it works.



    In my theme Default.jsp I do this :

    %
    PortletServiceHome cachedMapPortletServiceHome = null ;
    try {
    Context ctx = new InitialContext();
    Object home = ctx.lookup( "portletservice/com.ibm.portal.sample.portletservice.CachedMapPort letService" );
    if (home != null ) {
    cachedMapPortletServiceHome = (PortletServiceHome) home;
    System.out.println( "Default.jsp - init - CachedMapPortletService found" );
    }
    } catch (Exception ex) {
    // we can do without the service, if it is not available
    System.out.println( "Default.jsp - init - No CachedMapPortletServiceHome available" );
    }

    CachedMapPortletService service = null ;
    if (cachedMapPortletServiceHome != null ) {
    service = (CachedMapPortletService) cachedMapPortletServiceHome.getPortletService(Cach edMapPortletService.class);
    }
    String noRedirectContrat = (String)service.getGlobalData( "noRedirectContrat"




    Is the looking for the service each time too much, or could I store it somewhere to don't do the lookup everytime ?

  4. Re: [Portal Express 6] Value of attribute in session always null intheme J

    yes you can cache the lookup of the page



    If you do it like this







    So if we take yours







    any part you want to be in the declaration and init method you need to define with %!



    then the lookup is only done on the init of the jsp page




    IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0

    IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0



    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

  5. Re: [Portal Express 6] Value of attribute in session always null intheme J

    Thanks Jim !



    For this and for your amazing job on this forum !

+ Reply to Thread