JSF show icon without Button

If you want just a clickable image that trigger an action in the backing bean I suggest wrapping a graphic image in a h:commandLink.

<h:commandLink rendered="#{!task.IS_SEEN}" value="" action="#{YourBean.myAction}">
    <h:graphicImage  value="your-image-here"/>
</h:commandLink>

If you want easy to use, nice, vectorial icons I suggest you to check Font Awesome http://fontawesome.io/icons/ as well.

To use Font Awesome just include the following line in your <h:head>:

<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"></link>

Then you can easily put the icons inside commandLinks in this simple way:

<h:commandLink rendered="#{!task.IS_SEEN}" value="" action="#{YourBean.myAction}">
    <i class="fa fa-envelope"></i>
</h:commandLink>

Also you need specify css class ui-icon like this:

<h:panelGroup styleClass="ui-icon ui-icon-mail-closed" />

Tags:

Jsf

Primefaces