[jboss-user] [JBoss Portal] - PageRenderEvent and getNode for top level pages

shipmaster do-not-reply at jboss.com
Thu May 1 15:51:50 EDT 2008


Hi,

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

Thanks!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4148201#4148201

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4148201



More information about the jboss-user mailing list