如何在标记属性中添加outputFormat?
示例
...
<p:column headerText="#{msgs.actions}">
<p:commandButton id="btnDelEspai" icon="fa fa-trash Fs16 White"
styleClass="Fright RedButton" iconPos="right"
action="#{espaisBean.deleteEspai()}"
title="#{msgs.esp_delete}"
update="frmEspais:tblEspais frmEspais:error_panel">
<p:confirm header="#{msgs.delconfirmation}"
message="ADD CODE HERE" icon="ui-icon-alert">
</p:confirm>
<f:setPropertyActionListener value="#{e}"
target="#{espaisBean.selEspai}" />
</p:commandButton>
</p:column>
...
要添加的代码
<h:outputFormat value="#{msgs.esp_delconfirmation_id}" >
<f:param value="#{e.id}"/>
</h:outputFormat>
答案 0 :(得分:0)
只需使用EL调用方法即可。您可以使用OmniFaces中已有此类方法的String
functions:
#{of:format1('one {0}', 'two')}
或者您可以在bean中创建自己的方法:
XHTML:
#{yourBean.format1('one {0}', 'two')}
豆:
public String format1(String pattern, Object param) {
StringBuffer result = new StringBuffer();
new MessageFormat(pattern, getLocale()).format(param, result, null);
return result.toString();
}