如何在 Freemarker 中使用 Java BigDecimal?

发布于 2024-12-18 09:29:43 字数 108 浏览 5 评论 0原文

我从数据库中获取 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

毁虫ゝ 2024-12-25 09:29:43

您的意思是您想始终以科学记数法打印吗?您可以使用 ${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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文