1

I want to create such button in JSF.

<button class="btn btn-primary">
  <i class="fa fa-check"></i> 
  Save
</button>

But h:commandButton only allow to set the value of the button in attribute called "value". So I tried to create my button like that:

<h:commandButton class="btn btn-primary" value="<i class='fa fa-check'></i>Save" action="#{bean.save}" />

And got the error:

Error The value of attribute "value" associated with an element type "h:commandButton" must not contain the '<' character.

How can I embed HTML in h:commandButton?

nrofis
  • 8,975
  • 14
  • 58
  • 113
  • Possible duplicate of [jsf html tag inside value](http://stackoverflow.com/questions/19146515/jsf-html-tag-inside-value) – Kukeltje Apr 12 '16 at 13:08

1 Answers1

1

You have use like this

    <h:commandLink  style="width:20px;height:15px;" action="#{bean.smethodName()}"
      <i class="fa fa-searchfaicon2x"></i>                                    
    </h:commandLink>

Same for button

<h:commandButton class="btn btn-primary" value="Save" action="#{bean.save}">
<i class='fa fa-check'></i>
</h:commandButton>
Subodh Joshi
  • 12,717
  • 29
  • 108
  • 202