通过计算结果访问数组索引

发布于 2025-01-08 11:09:56 字数 346 浏览 3 评论 0原文

我尝试使用计算结果作为索引来访问数组。

status.index 来自一个 tr:iterator 变量 varStatus

然而,这似乎是内部的双精度值,因为我得到了 javax.servlet.ServletException: For input string: "0.0" 。

我可以以某种方式将其转换为整数吗?

I try to access an array using as index the result of a calculation.

<tr:outputText value="#{myController.form.model.arr[(status.index / 15)]}"/>

status.index comes from a tr:iterator variable varStatus.

It seems howewer, that this is a double value internally as I get a javax.servlet.ServletException: For input string: "0.0".

Can I somehow cast this to an integer?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

爱的十字路口 2025-01-15 11:09:56

抱歉,已经解决了。我有另一个星座,其中 .toString 是通过自己的方法添加的。它的工作方式与此处发布的方式相同。

Sorry it has been resolved. I had another constellation where a .toString was added by an own method. It works the way it is posted here.

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