title: How can I pass selected row to commandLink inside dataTable or ui:repeat?
body: <p>I'm using Primefaces in a JSF 2 application. I have a <code>&lt;p:dataTable&gt;</code>, and instead of selecting rows, I want the user to be able to directly execute various actions on individual rows. For that, I have several <code>&lt;p:commandLink&gt;</code>s in the last column.</p>
  
  <p>My problem: how can I pass a row ID to the action started by the command link so that I know which row to act on? I tried using an <code>&lt;f:attribute&gt;</code>:</p>
  
  <pre><code>&lt;p:dataTable value="#{bean.items}" var="item"&gt;
      ...
      &lt;p:column&gt;
          &lt;p:commandLink actionListener="#{bean.insert}" value="insert"&gt;
              &lt;f:attribute name="id" value="#{item.id}" /&gt;
          &lt;/p:commandLink&gt;
      &lt;/p:column&gt;
  &lt;/p:dataTable&gt;
  </code></pre>
  
  <p>But it always yields 0 - apparently the row variable <code>f</code> is not available when the attribute is rendered (it works when I use a fixed value).</p>
  
  <p>Anyone has an alternative solution?</p>