JSF show icon without Button

前端 未结 3 1614
太阳男子
太阳男子 2021-01-02 17:31

Hi guys I want to show the icons without buttons but it doesn\'t work. I get the following message: no Mime-Type was Found. The two icons are default icons from Primefaces.<

相关标签:
3条回答
  • 2021-01-02 17:34

    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>
    
    0 讨论(0)
  • 2021-01-02 17:44

    those are in fact CSS classes that point to a sprite file, so technically they are not icons.

    try using:

    <h:panelGroup styleClass="ui-icon-mail-closed" rendered="#{!task.IS_SEEN}" />
    

    and if there's a need style it accordingly with padding.

    0 讨论(0)
  • 2021-01-02 18:00

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

    <h:panelGroup styleClass="ui-icon ui-icon-mail-closed" />
    
    0 讨论(0)
提交回复
热议问题