0 Replies Latest reply: Feb 16, 2012 1:00 AM by Vikas V RSS

Phase listener not calling after logging out

Vikas V Newbie

Hi,

 

Am using JSF 1.2 , Jboss AS 5.1.0 , Liferay Portal 6.0

 

When I login, my Phaselistener gets called and I will land on Home page. My beans are in Request scope for Home Page except for one bean which is in Session Scope.

 

The bean which is in Session scope contains a link in it which redirects to a different page from Home page. If that is also made Request scope, redirection doesnt happen to another page and it stays in the same page.

 

Now if I logout and login again, Home page is not displayed. May be the session scope which is there for one of the beans in Home Page is getting applied and its thinking that its in same session and so my Phaselistener is not getting called after I logout and login again.

 

 

My faces-config.xml contents are below,

 

<managed-bean>

  <managed-bean-name>homePageBean</managed-bean-name>

  <managed-bean-class>com.tsky.selfcare.HomePage.bean.HomePageBean</managed-bean-class>

  <managed-bean-scope>request</managed-bean-scope>

</managed-bean>

<managed-bean>

  <managed-bean-name>userInfoBean</managed-bean-name>

  <managed-bean-class>com.tsky.selfcare.HomePage.bean.UserInfoBean</managed-bean-class>

  <managed-bean-scope>request</managed-bean-scope>

</managed-bean>

<managed-bean>

  <managed-bean-name>ppvBean</managed-bean-name>

  <managed-bean-class>com.tsky.selfcare.HomePage.bean.PPVBean</managed-bean-class>

  <managed-bean-scope>session</managed-bean-scope>

</managed-bean>

 

My phaselistener code is as below,

 

 

 

 

public class CustomPhaseListener

  implements PhaseListener, Serializable

{

  private static final long serialVersionUID = 1L;

  private Logger log = Logger.getLogger(CustomPhaseListener.class);

 

  public PhaseId getPhaseId()

  {

    this.log.info("Entered into getPhaseId");

    return PhaseId.RENDER_RESPONSE;

  }

 

  public void beforePhase(PhaseEvent e)

  {

    this.log.info("Entered into beforePhase");

    FacesContext context = null;

    try

    {

      context = e.getFacesContext();

      HomePageBean bean = (HomePageBean)context.getApplication().getVariableResolver().resolveVariable(context, "homePageBean");

      PPVBean ppvbean = (PPVBean)context.getApplication().getVariableResolver().resolveVariable(context, "ppvBean");

     

      ppvbean.getMoviesList();

      bean.initializeBean();

           

    }

    catch (Exception e1) {

      e1.printStackTrace();

    }

  }

 

 

After I logout am destroying the session created.

 

But still after I logout and login again Phase listener is not getting called..

 

How to resolve this?

 

Regards,

 

Vikas