Number format is JSP when using JSTL <sql:query> along with <c:forEach> tag. Simple  beginners question !!

Posted on 2006-05-15
Last Modified: 2013-11-24
Hello I am using <sql:query> along with <c:forEach> tag to display contents of a database table. It works fine.
But now i want to format the numeric values returned from the Select statement.

for example. In the code below the col1 values returned from sql are numeric without any 1000 separator commas. Eg 1000, 10000, 1000000 etc.

I want to format them to display 1000 separator commans i.e 1,000, 10,000, 1000,000 etc. How can I do it ?

<sql:query> ...</sql:query>
     <td><c:out value="${row.col1}" /></td>

Question by:MFCAnswer
    1 Comment
    LVL 4

    Accepted Solution

    Instead of the <c:out> tag try using <fmt:formatNumber value="${row.col1}"/>
    That should format the number correctly for your locale.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    how to hide hide popup page refresh second time? 10 60
    scoreUp challenge 14 40
    parentbit challenge 3 36
    Modeling a class in java 5 22
    I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now