title: p:ajax inside h:graphicImage
body: <p>I have problem firing an ajax request with Primefaces</p>
  
  <pre><code>&lt;f:metadata&gt;
    &lt;f:viewParam name="token" value="#{clientBean.token}"/&gt;
    &lt;f:event type="preRenderView" listener="#{clientBean.getParameter}" /&gt;
  &lt;/f:metadata&gt;
  &lt;h:form&gt;
    &lt;h:graphicImage id="id1" url="/images/circle-ok.png" onclick="dTag.show();"/&gt;
    &lt;p:commandButton id="id4" value="T" actionListener="#{clientBean.tag}" /&gt;  
  
    &lt;!-- This does not work --&gt;
    &lt;h:graphicImage id="id2" url="/images/circle-ok.png"&gt;
      &lt;p:ajax id="id3" event="onclick" onstart="dTag.show();"
              actionListener="#{clientBean.tag}" /&gt;
    &lt;/h:graphicImage&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>The first <code>h:graphicImage</code> opens the dialog correctly, the <code>p:commandButton</code> triggers the actionListener correctly, but the <code>p:ajax</code> has no effects (tested on googles app engine).</p>
  
  <p><strong>Update 1</strong>
  Changing the <code>event</code> from <em>onclick</em> to <em>click</em> was absolutely right (thanks BalusC): Now the <code>p:dialog</code> is shown. But still the <code>tag()</code> method is not invoked. I've updated the <code>xhtml</code>-Code  with <code>f:metadata</code> because there is one additional logging.
  I think it's related to <code>p:ajax</code> and the invocation of the bean, I've tried <em>actionListener</em>, <em>action</em> and <em>listener</em> (from the documentation of Primefaces) with the same result:</p>
  
  <ul>
  <li>The app engines logs the invocation of <code>getParameter(ComponentSystemEvent event)</code> and Firebug shows this partial-update: <code>&lt;changes&gt;&lt;update id="otCounter"&gt;&lt;![CDATA[&lt;span id="otCounter"&gt;0&lt;/span&gt;]]&gt;&lt;/update&gt;</code>..</li>
  <li>The invocation of <code>public void tag(ActionEvent ae)</code> is not logged (also tried <code>public void tag()</code>)</li>
  </ul>
  
  <p>The <code>p:commandButton</code> updates the counter correctly.</p>
  
  <p><strong>Update 2</strong>
  I've removed the <code>f:viewParam</code> and <code>f:event</code> for simplicity and now are using <code>listener</code> and <code>public void tag()</code>, but the method is not called :-(</p>
  
  <p><strong>Update 3</strong> The answer of BalusC is correct, I have other problems when using it here: <a href="https://stackoverflow.com/questions/7316486">JSF and p:ajax inside p:dataTable inside ui:repeat</a></p>