Convertnumber JSF negative values

Asked

Viewed 281 times

1

Negative monetary values when using the native JSF converter, <f:convertNumber type="currency"/>, stand with the character '-', before 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 to solve this problem without me having to create my own Converter?

1 answer

0


If the problem in simply using:

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

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

ex: -R$ 56.134.726,99

Applying the following term

<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 symbol R$.

ex: R$ -56.134.726,99

  • If possible, further develop the explanation, explain the parts of your answer, what are each attribute of <f:>, , and how do they work.? In the written way you simply threw codes saying to apply such Pattern

  • Yes, greatly improved the quality of your response.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.