show icon with p:commandLink

Dave picture Dave · Oct 15, 2016 · Viewed 14.6k times · Source

How to show an icon with commandLink:

<p:commandLink 
         styleClass="ui-icon ui-icon-plus"
         action="#{bean.doSomething}"     >

         <h:outputText value="Add" />   
</p:commandLink>

The outputText (Add) is not visible. What is the right way for commandLink to support icon? Thanks.

Answer

wysouf picture wysouf · Jul 21, 2017
<p:commandLink action="#{bean.doSomething}">
     <h:outputText value="Add" class="ui-icon ui-icon-plus"/>   </p:commandLink>