You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Michael Heinen <mh...@recommind.com> on 2006/12/07 11:36:53 UTC

init requestScopedBean during renderResponse?

I have one question regarding the initialization of request scoped
backing beans.

 

Is it a good practice to initialize attributes lazy in phase
renderResponse only?

Sometimes I want to prevent that an attribute of a request scoped Bean
is initialized again after a button has been clicked and the navigation
goes to another page

where the former bean is not used anymore. 

 

e.g.

public List getXXX()

{

  if (this.xxx == null &&
FacesContext.getCurrentInstance().getRenderResponse() )

  {

    this.initializeXXX();

  }

  return this.xxx;

}

 

Any comments?

Michael