Reputation: 7919
How could I add an outputFormat inside a tag attribute?
Example
...
<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>
...
Code to add
<h:outputFormat value="#{msgs.esp_delconfirmation_id}" >
<f:param value="#{e.id}"/>
</h:outputFormat>
Upvotes: 1
Views: 315
Reputation: 20188
Simply call a method using EL. You could use OmniFaces which already has such a method in the String
functions:
#{of:format1('one {0}', 'two')}
or you could create your own method in a bean:
XHTML:
#{yourBean.format1('one {0}', 'two')}
Bean:
public String format1(String pattern, Object param) {
StringBuffer result = new StringBuffer();
new MessageFormat(pattern, getLocale()).format(param, result, null);
return result.toString();
}
Upvotes: 1