Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's important to know and understand that the <code>&lt;f:convertNumber&gt;</code> tag uses <a href="http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html" rel="nofollow"><code>DecimalFormat</code></a> under the covers. You can find all pattern characters in <a href="http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html" rel="nofollow">its javadoc</a>.</p> <p>It seems that you expected that the <code>DecimalFormat</code> pattern characters <code>,</code> and <code>.</code> are also actually used in the final format. This is untrue. It are really merely <em>pattern characters</em> (like as <code>d</code>, <code>M</code>, <code>y</code>, etc as used by<code>SimpleDateFormat</code>). Basically, the pattern character <code>,</code> tells <code>DecimalFormat</code> to print the "grouping separator" as specified by the given locale and, equivalently, the pattern character <code>.</code> tells <code>DecimalFormat</code> to print the "decimal separator" as specified by the given locale.</p> <p>In effects, the actual character being printed depends on the given locale. For English locale (<code>locale="en"</code>), the "grouping separator" being printed is just coincidentally also <code>,</code>, but for German locale (<code>locale="de"</code>) the "grouping separator" being printed is indeed <code>.</code>.</p> <hr> <p><strong>Unrelated</strong> to the concrete problem, the <code>type</code> attribute of <code>&lt;f:convertNumber&gt;</code> has totally no effect if the <code>pattern</code> attribute is specified. The <code>type</code> attribtue is basically superfluous in this example and can safely be removed without any side effects.</p> <p>If you remove the <code>pattern</code> attribute, then it'll actually be used and you'll see that the default pattern for a currency is being used, which is same as <code>¤#,##0.00</code> for English locale and <code>¤ #,##0.00</code> for German locale. Also note that the pattern character representing the currency symbol is not <code>$</code>, but <code>¤</code>. The currency symbol can be set separately via <code>currencySymbol</code> attribute. So the correct approach for currencies would be:</p> <pre class="lang-html prettyprint-override"><code>&lt;f:convertNumber type="currency" locale="#{userSession.locale}" currencySymbol="$" /&gt; </code></pre> <p>Again, see the <code>DecimalFormat</code> javadoc as linked before.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload