0 Replies Latest reply on May 1, 2008 3:51 PM by Muhammad Yahia

    PageRenderEvent and getNode for top level pages

    Muhammad Yahia Newbie


      I have the following structure of pages:

      default -> Page1 -> Page2

      I am trying to create an event listener that reads some property off the currently rendering page and sets it as a value in user session, I did the following:

      public PortalNodeEvent onEvent(PortalNodeEventContext ctx,
       PortalNodeEvent event) {
       if(event instanceof PageRenderEvent)
       PageRenderEvent renderEvent=(PageRenderEvent) event;
       String category=(String)renderEvent.getNode().getProperties().get("category");
       ctx.getPortalRuntimeContext().getSession().setAttribute("currentCategory",category );
       return ctx.dispatch();

      Which seems to work fine for Page2 but not for default or Page1, the event fires ok on each render but getNode has an empty category property, and sometimes, when i go to Page2 then back to Page1, category is still the one for Page2. I also tried getEvent.getPageName and it behaves in the same way, so it is not a property problem. Any idea what I am doing wrong?

      I am on Jboss Portal 2.6.4