1 Reply Latest reply: Jan 22, 2012 3:51 AM by Vikas V RSS

Custom Phase Listener getting called 3 times !

Vikas V Newbie

Hi,

 

Am using JSF 1.2 , Jboss As 5.1.0 , Liferay Portal 6.

 

My CustomPhaseListener is getting called 3 times !!!

 

Below is my CustomPhaseListener,

 

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();

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

     

     

myBean.initializeBean();

           

    }

    catch (Exception e1) {

      e1.printStackTrace();

    }

  }

 

  public void afterPhase(PhaseEvent e)

  {

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

  }

}

 

Please let me know how can I make my CustomPhaseListener to get called only once.

 

Regards,