title: Bind the value of an input component to a list item by index
body: <p>here is an example :</p>
  
  <pre><code> &lt;h:outputLabel for="category1" value="Cateogry"/&gt;
   &lt;h:selectOneMenu id ="category1" value="#{articleManageBean.categoryId1}" 
     converter="categoryConverter"&gt;
  
       &lt;f:selectItems value="#{articleManageBean.categories}" var="category"
           itemValue="#{category.id}" itemLabel="#{category.name}" /&gt;
  
   &lt;/h:selectOneMenu&gt;
  </code></pre>
  
  <p>and here is the managed bean that I have</p>
  
  <pre><code>@ManagedBean
  @SessionScoped
  public class ArticleManageBean {
  
     private Long categoryId1;
     private List&lt;Category&gt; categories;
  
     //...
  }
  </code></pre>
  
  <p>The categories list gets populated from db, and selectOneMenu gets populated with this list using a converter.</p>
  
  <p>My First question: 
  If I want to create another selectOneMenu in my jsf page I would have to copy paste the entire thing and just change the value of selectOneMenu to say categoryId2 thus putting another attribute to managed bean called categoryId2. That is not practical. I want to map these values of selectMenu to list items, for instance to an  attribute </p>
  
  <pre><code> List&lt;Long&gt; categoryIds;
  </code></pre>
  
  <p>if I use </p>
  
  <pre><code> &lt;h:selectOneMenu id ="category1" value="#{articleManageBean.categoryIds.[0]}"  &gt;
  </code></pre>
  
  <p>I get an error</p>
  
  <pre><code> javax.el.PropertyNotFoundException: /createArticle.xhtml @47,68 value="#{articleManageBean.categoriesId[0]}": Target Unreachable, 'null' returned null 
  </code></pre>
  
  <p>If I nitialize the Araylist then I get this exception</p>
  
  <pre><code> javax.el.PropertyNotFoundException: /createArticle.xhtml @47,68 value="#{articleManageBean.categoriesId[0]}": null 
  </code></pre>
  
  <p>My second question:
  Is there a way to dinamicly write selectOneMenu tags, by that I mean not to copy paste the entire tag, just somehow create a function that take the categoryId parameter and writes automaticaly the tag (somekind of custom tag maybe ?)</p>
  
  <p>Hope you understood my questions</p>
  
  <p>thanks in advance   </p>