title: Create jsf bean in code (Session Listener in this case) causes infinite loop
body: <p>First of all, All is done in JSF 1.2.
  In short, I have this code:</p>
  
  <pre><code>public class MobileConfigurationToolSessionListener implements HttpSessionListener {
  
  @Override
  public void sessionCreated(HttpSessionEvent event) {
          ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
          externalContext.getSessionMap().put("myBean", new MyBean());
      }
  ...
  }
  </code></pre>
  
  <p>The bean is accessed from the JSF context as a regular JSF session bean.</p>
  
  <pre><code>&lt;h:outputText value="#{myBean.textMsg}"/&gt;
  </code></pre>
  
  <p>The result is an almost infinite loop which finally ends due to:</p>
  
  <pre><code>011-04-06 15:47:42,435 WARN  [http-80-1] org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase PanelGrid GeneralConfigForm:j_id_jsp_1651416019_7:0:GeneralDetailPanel has not enough children. Child count should be a multiple of the columns attribute.
  2011-04-06 15:47:42,825 IDT] E 0000000c (org.apache.catalina.connector.CoyoteAdapter#service) An exception or error occurred in the container during the request processing
  ava.lang.ArrayIndexOutOfBoundsException
  </code></pre>
  
  <p>What I'm trying to achieve is to create a bean object by my self (According to URL parameters or cookies) in the session listener and "inject" the new bean to the JSF session.</p>
  
  <p>What Am I doing wrong?</p>
  
  <h2>Thanks!</h2>
  
  <p><strong>EDIT</strong>- I thought that another solution could be to make the myBean instantiate somehow by JSF and then run methods on it to achieve the same idea. 
  I remember a @BalusC article on how to make JSF instantiate a bean from code but I couldn't find it. (I'm Guessing @BalusC will answer me on this so thanks in advance :-) )</p>