Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7908237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:50:39+00:00 2026-06-03T11:50:39+00:00

I am using JSF 2 and RichFaces 3. Here in the picture shown below,

  • 0

I am using JSF 2 and RichFaces 3. Here in the picture shown below, numbers are being displayed as what they are in the database.

enter image description here

But I want to display them as 6749395.20 if fraction part is there and 5095138.00 if no fraction part is there.

As of now I have tried something like this.

 <rich:column>
    <f:facet name="header">
        <h:outputText value="Total Amount"/>
    </f:facet>
    <h:outputText value="#{rr[2]}">
        <f:convertNumber type="number" groupingUsed="true" minFractionDigits="2" pattern="#0.00"/>
    </h:outputText>
 </rich:column>

Actually I am showing all of them together, but I have tried with all of them as all possible combinations with type, groupingUsed, minFractionDigits and pattern.

Why does it not work? How is this caused and how can I solve it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:50:42+00:00Added an answer on June 3, 2026 at 11:50 am

    That can happen if the value is not a Number at all, for example a String. You’re then basically using the wrong type for the data it represents. To represent currencies in Java, you should be using BigDecimal. Also, make sure that the type in the database table is right, i.e. it should not be a varchar, but a decimal.

    Once you’ve fixed the data type, then the <f:convertNumber> will work as you told it to do. Note that the pattern attribute will override the groupingUsed and minFractionDigits. You should use either the pattern or the others. Also, type="number" is already the default, so it can be removed.

    So, either use

    <f:convertNumber pattern="#0.00" />
    

    or

    <f:convertNumber groupingUsed="true" minFractionDigits="2" />
    

    Note that they generate different formats. You probably want to set grouping to false.

    You can also use type="currency", it will then automatically apply the right pattern as per the UIViewRoot#getLocale():

    <f:convertNumber type="currency" />
    

    See also the tag library documentation and the DecimalFormat javadoc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Richfaces JSF and I want to iterate over an Map<Object,Object> . I
I want to look at using JSF but I'm put off by what appears
I'm making a website Using JSF and richfaces, but I need to do some
I am using JSF, richfaces 4 stuff and i want to call a bean
I want to perform the following task using JSF / Richfaces On click of
I am developing simple application using JSF with richfaces. I want to upload folder(select
I'm using JSF 1.2 with Richfaces and Facelets. I have an application with many
I'm using JSF (Mojarra 1.2) with Richfaces (3.3.2) within some facelets which are used
Using Richfaces 3.3.0GA, jsf 1.2_14 and facelets. I have a richfaces ModalPanel with an
I am using JSF with richfaces3.3.3, other jsf capabilities working but i don't know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.