title: How can I populate data in JSF
body: <p>Up until now, I have always been using JSP to display pages. When a user request for a page such as "Add Item", I will load all Item Category in an Array List and display them as options in select box like this:</p>
  
  <pre><code>&lt;select name="category&gt;
      &lt;%
          ArrayList&lt;Category&gt; categories = (ArrayList&lt;Category&gt;) request.getAttribute("categories");
          for (Category c : data) {
      %&gt;
      &lt;option value="&lt;%= c.getId() %&gt;"&gt;&lt;%= c.getName() %&gt;&lt;/option&gt;
      &lt;%
          }
      %&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>From the book "JavaServer Faces 2.0, The Complete Reference", I learnt that: "JSF enforces clean Model-View-Controller separation by disallowing the inclusion of Java code in markup pages". Hence, I'd be very grateful if someone could show me how I can handle the above task using JSF since I cannot use Java code as I have always done anymore.</p>
  
  <p>Best regards,</p>
  
  <p>James Tran</p>