[jboss-user] [JBoss Portal] - Problem with PortletSession

aspdeepak do-not-reply at jboss.com
Mon May 4 03:36:13 EDT 2009


Jboss App Server V 4.2.2
Jboss Portal - V 2.7.0
DB - Mysql 5.0 

I need to perform certain logic when the user logs in.

ie, for each session I need to perform certain logic, that too in start of the session.

This is my code, where i get a  PortletSession attribute IS_FIRST_LOAD  which is obviously null at the start of every new session. Then i am setting some value, so that the IS_FIRST_LOAD  attribute will not be null afterwards.

Portlet A - doView() implementation

	String isFirst =(String) request.getPortletSession().getAttribute(IS_FIRST_LOAD);
  | 		log.info(" IS_FIRST_LOAD (before) = "+isFirst);
  | 		
  | 		
  | 		if ( isFirst == null) { // if this is the first time loading
  | 			request.getPortletSession().setAttribute(IS_FIRST_LOAD,"false",PortletSession.PORTLET_SCOPE);
  | 		
  | 			log.info(" showing the default charts(COLLECTION since IS_FIRST_LOAD )");
  | 			
  | 			
  | 			log.info(" IS_FIRST_LOAD (after) = "+request.getPortletSession().getAttribute(IS_FIRST_LOAD));
  | 
  |                         ..............................................
  |                         ..............................................
  | 			
  | 		}


In my case the PortletA's doView() will be called more than once.
let's say minimum of 3 times. before the page gets completely rendered.


when PortletA's  doView() called for the first time the PortletSession attribute returns null so the logic works fine, (note: that the page is still not rendered completely).
when it is called for 2 nd time PortletSession attribute returns null, which is not desirable,

when it is called for 3rd time PortletSession attribute returns non null, and from here on every thing is working fine.


So what is the reason behind the clearing of the PortletSession ? 


Any help is greatly appreciable.

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

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



More information about the jboss-user mailing list