David, all,

I've found a fix for this (after a lot of code digging) in rev. 451937

I hope this is a good solution (but I think it is ok).
Thanks for your valuable comments.

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


Reply via email to