JSF 2.0 graphicImage: set background-image by css
<p>I have a commandLink primefaces with an internal graphicImage (JSF 2 with Primefaces 5).</p>

<p>Following code works fine:</p>

<pre><code>&lt;p:commandLink action="#{mybean.mymethod()}" process="@this"&gt;

   &lt;h:graphicImage name="images/one.jpg" 
   rendered="#{myBean.test.size() == 0" /&gt;

&lt;/p:commandLink&gt;
</code></pre>

<p>Unfortunately, I have any graphicImage in my application so I would like set image in a css class. </p>

<p>I think about something:</p>

<pre><code>&lt;p:commandLink action="#{mybean.mymethod()}" process="@this"&gt;

   &lt;h:graphicImage styleClass="myClass" 
   rendered="#{myBean.test.size() == 0" /&gt;

&lt;/p:commandLink&gt;
</code></pre>

<p>where my css file is following:</p>

<pre><code>.myClass {
     background-image: url('/myApplication/resources/images/one.jpg');
}
</code></pre>

<p>but doesn't work.</p>

<p>Is it possible? Otherwise, how can I replace graphicImage component? I try with img tag or adding a class in commandLink component with a background-image but doesn't work.</p>

<p>Any idea?</p>

<p>Thanks.</p>