Jsf h:commandButton带有twitter引导或其他图标

Jsf h:commandButton带有twitter引导或其他图标,jsf,twitter-bootstrap,Jsf,Twitter Bootstrap,我正在使用twitter引导css来设计样式。要在其中制作图标按钮,标准方法是使用“i”标记。 但我不能进入它里面 如何在呈现的中添加HTML?我刚刚使用了一个hack。它是这样的(我隐藏了h:commandButton并添加了一个新的submit按钮) 您可以在h:commandLink 命令链接可以设置为按钮样式 <h:commandLink id="btnsearch" action="search.xhtml" styleClass="btn btn-defa

我正在使用twitter引导css来设计样式。要在其中制作图标按钮,标准方法是使用“i”标记。


但我不能进入它里面

如何在呈现的
中添加HTML?

我刚刚使用了一个hack。它是这样的(我隐藏了h:commandButton并添加了一个新的submit按钮)


您可以在
h:commandLink

命令链接可以设置为按钮样式

<h:commandLink id="btnsearch"
    action="search.xhtml"
    styleClass="btn btn-default">
    <i class="icon-search"></i> Search
</h:commandLink>

搜寻

我发现使用此解决方案,由于它呈现锚定标记,因此表单不会在enter时提交。除此之外,这是一个很好的解决方案。如果您使用此解决方案,并结合balusC的答案,回车键也会起作用。
<h:commandLink id="btnsearch"
    action="search.xhtml"
    styleClass="btn btn-default">
    <i class="icon-search"></i> Search
</h:commandLink>