title: Rendering JSF pages using information from sessions
body: <p>I have the following JSF page:</p>
  
  <pre><code>&lt;h:head&gt;
      &lt;title&gt;Admin Page&lt;/title&gt;        
  &lt;/h:head&gt;
  &lt;h:body&gt;
  
      &lt;h1&gt;Users List&lt;/h1&gt;
  
      &lt;h:dataTable value="#{adminBean.linkArr}" var="o" &gt;
  
          &lt;h:column&gt;
              &lt;f:facet name="header"&gt;User name&lt;/f:facet&gt;
              #{o.username}
          &lt;/h:column&gt;
  
      &lt;/h:dataTable&gt;        
  
  &lt;/h:body&gt;
  </code></pre>
  
  <p>And a managed bean like this:</p>
  
  <pre><code>@ManagedBean(name="adminBean")
  @SessionScoped
  public class AdminBean {
  
  private static UserLink[] linkArr;
  
  public AdminBean() {
      FacesContext context = FacesContext.getCurrentInstance();  
      HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();  
      HttpSession session = request.getSession();
  
      String values[] = (String[])request.getSession().getAttribute("userList");
  
      int userNos = values.length;
      linkArr = new UserLink[userNos];
  
      for(int i = 0; i &lt; userNos; ++i) {
          String tmp = values[i];
          linkArr[i] = new UserLink(tmp);
      }                
  }
  public UserLink[] getLinkArr() {
      return linkArr;
  }
  
  public static class UserLink {
  
      public String username;
  
      public UserLink(String username) {
          this.username = username;
      }
  
      public String getUsername() {
          return username;
      }
  }
  }
  </code></pre>
  
  <p>What I am actually trying to do is: </p>
  
  <p>Save some data from a previously called servlet by creating a session. Assuming that a managed session bean is only created when its associated XHTML file is called, I am getting the attributes from the session object and using then to populate a JSF table. </p>
  
  <p>However, instead of a JSF table, I am getting the following output:</p>
  
  <pre><code>Users List
  
  User name #{o.username}
  </code></pre>
  
  <p>Am I assuming a wrong lifecycle for a managed session bean or there is some problem in my JSF page?</p>