[英]Conditionally render title attribute of p:commandButton
我们可以在ap:commandbutton内使用facet,以便我们可以根据支持bean的属性更改命令按钮的title
属性吗?
<p:commandButton id="btnSave" action="#{serviceController.saveSelected()}" ajax="false" >
<f:facet name="title" >
<h:outputLabel value="Save Details" rendered="#{serviceController.current.id eq null}" ></h:outputLabel>
<h:outputLabel value="Update Details" rendered="#{serviceController.current.id ne null}" ></h:outputLabel>
</f:facet>
</p:commandButton>
但这是行不通的。 这就像不给value属性赋予任何值。
它甚至更容易:
<p:commandButton value="#{serviceController.current.id eq null? 'Save Details' : 'Update Details'}"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.