title: How to set selected item in bean in <p:dataList>
body: <p>I am using <code>p:dataList</code> because I am developing a PrimeFaces mobile view displaying a list of items. When clicking on any item, another <code>pm:view</code> of the same view should be displayed. But the bean should be notified of the selected item.</p>
  
  <p>Unfortunately I couldn't find a way to update the bean successfully: <code>&lt;p:ajax&gt;</code> inside dataTable throws this exception:</p>
  
  <pre><code>&lt;p:ajax&gt; Unable to attach &lt;p:ajax&gt; to non-ClientBehaviorHolder parent
  </code></pre>
  
  <p>Using <code>&lt;f:setPropertyActionListener&gt;</code> inside the iterative element  fails too because I get:</p>
  
  <pre><code>&lt;f:setPropertyActionListener&gt; Parent is not of type ActionSource
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>&lt;pm:view  id="instrumentsView" &gt;
      &lt;pm:content &gt;
          &lt;h:form id="instrumentsList" &gt;                            
              &lt;p:dataList var="instrument" value="#{instrumentBean.subscribedInstruments}" &gt;
                  &lt;h:outputLink value="#newView" &gt;#{instrument.longName}&lt;/h:outputLink&gt;
                  &lt;f:setPropertyActionListener value="#{instrument}" target="#{instrumentBean.selectedInstrument}" /&gt;
              &lt;/p:dataList&gt;
          &lt;/h:form&gt;
      &lt;/pm:content&gt;
  &lt;/pm:view&gt;
  </code></pre>
  
  <p>Clearly, I am using dataList and outputLink because as far as I understand, they are the components optimized for the use in PrimeFaces mobile lists. But I am available to find other options if necessary.</p>