0

I have a page which will be available in several locales and would like to store a number in a hidden field for the purpose of calculations, for example:

I want to have the value 7.00 in there no matter what the locale is. If I go the route of using (I'm using spring to populate the view and would prefer not having to change anything on what is passed to the view):

<fmt:formatNumber var="somenumberineed1" value="${somenumberigot1}" minFractionDigits="2" />
<input type="hidden" id="somenumberineed1" value="${somenumberineed1}">

I'll end up with this for some European countries:

<input type="hidden" id="somenumberineed1" value="7,00">

Is there some way to just print the number with a set minimum fractional digits using jstl? I'd preferably not like to mess around with the set locale.

Taji
  • 120
  • 6

1 Answers1

0

You could write a custom EL function which manually formats the float using java.text.DecimalFormat with custom java.text.DecimalFormatSymbols (or just create a DecimalFormatSymbols instance using Locale.US).

Community
  • 1
  • 1
Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102