David,
thanks for the hints, they are very useful and I'll dig the code
tomorrow morning to see how I could handle this: in my opinion the best
way to go is (if possible) to represent the values as they are in the db.
Jacopo
David E Jones wrote:
Jacopo,
I believe FreeMarker has a default number formatter that is used when
you do something like ${doubleVariable}.
In general with FreeMarker, and we have of course had to do with various
other things, if you want it formatted in a certain way you have to
explicitly format it in that way.
If the concern here is about the default formatter, chances are we could
change that in the FreeMarkerWorker.java file to have a better default
for FTL files used in OFBiz.
-David
On Oct 1, 2006, at 9:20 AM, Jacopo Cappellato wrote:
Let's say that, in the context of an ftl template, I have a double
variable:
context.put("doubleVariable", new Double(0.123456));
The following code inside an ftl template:
Double: ${doubleVariable}
Double.toString(): ${doubleVariable.toString()}
is rendered in this way:
Double: 0.123 (WRONG!!!)
Double.toString(): 0.123456 (CORRECT)
Why is this happening?
I think that this is a pretty serious thing since all the numeric
fields (e.g. in widgets) are affected by this and the numbers
displayed on screen can be incorrect.
Thanks!
Jacopo