ConvertNumber of JSF negative values

1

Negative monetary values, when using the native JSF converter, <f:convertNumber type="currency"/> , are left with the character ' - ', before the R $.

For example: -R$ 56.134.726,99

.xhtml

<p:column>
    <h:outputText value="#{entidade.valorMonetário}">
        <f:convertNumber type="currency"/>
    </h:outputText>
</p:column>

Is there any way I can solve this problem without having to create my own Converter?

    
asked by anonymous 23.08.2017 / 18:29

1 answer

0

If the problem is to simply use:

<p:column>
    <h:outputText value="#{entidade.valorMonetário}">
        <f:convertNumber type="currency"/>
    </h:outputText>
</p:column>

and the negative ( '-' ) is behind the symbol R$

ex: -R$ 56.134.726,99

Applying the following pattern

<p:column>
    <h:outputText value="#{entidade.valorMonetário}">
        <f:convertNumber type="currency" currencySymbol="R$" locale="pt_BR" pattern="¤ ###,###,##0.00; ¤ -###,###,##0.00"/>
    </h:outputText>
</p:column>

The negative ( '-' ) is after the R$ symbol.

ex: R$ -56.134.726,99

    
23.08.2017 / 23:05