如何在 Freemarker 中使用 Java BigDecimal?
我从数据库中获取 BigDecimal 值。它等于“0E-10”。当它传递给 freemarker 时,该值被包装为 0。
我已经尝试将算术引擎切换为 BigDecimal,但它没有用。
I get the BigDecimal value from a DB. It equals '0E-10'. When it is passed to a freemarker, the value is wrapped as 0.
I have already tried to swith on an arithmetic engine as a BigDecimal one, but it had no use.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的意思是您想始终以科学记数法打印吗?您可以使用 ${variable?string("0.##E0")} 在 Freemarker 中执行此操作。 Freemarker 会自动将内容转换为用户友好的字符串,除非您告诉它特定的格式。
Do you mean you want to always print out in scientific notation? You can use ${variable?string("0.##E0")} to do that in Freemarker. Freemarker auto-converts things to user-friendly strings unless you tell it a specific format.
按照这个,http://freemarker.sourceforge.net/docs/ref_builtins_number.html#ref_builtin_string_for_number< /a>
follow this, http://freemarker.sourceforge.net/docs/ref_builtins_number.html#ref_builtin_string_for_number