• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1209
  • Last Modified:

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

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>

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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now