Stripes 包裹表单输入不会计算 c:foreach 的 Loop.index 值

发布于 2025-01-06 19:02:31 字数 1096 浏览 2 评论 0原文

我所做的一切就像在 stripes 指南中一样,在我的 jsp 中有简单的代码:

<c:forEach items="${management.projects}" var="project" varStatus="loop">
<tr>
<td>
    <c:out value="${loop.index}"/>
    <stripes:text name="project[${loop.index}].projectId"/>
</td>
</tr>
</c:forEach>

所以然后在 html 页面上我可以看到 0,1,2.. 作为 < /code> 计算了loop.index,但输入的名称类似于 而不是

我尝试过 ' 和 " 以及

对于 html 表单输入我发现它看起来像这样 。 这看起来正确但如果我尝试在条纹标签中使用它,就像

<stripes:text name="<c:out value='project[${loop.index}].projectId'/>"/>

它再次失败一样 - 看起来像:

<input name="<c:out value='project[${loop.index}].projectId'/>" type="text"/>

我做错了什么?

I'm doing everything like it is in stripes guide, having simple code in my jsp:

<c:forEach items="${management.projects}" var="project" varStatus="loop">
<tr>
<td>
    <c:out value="${loop.index}"/>
    <stripes:text name="project[${loop.index}].projectId"/>
</td>
</tr>
</c:forEach>

so then on the html page I can see 0,1,2.. as <c:out...> calculated loop.index, but the name of inputs looks like <input name="project[${loop.index}].projectId" type="text"/>
instead of <input name="project[0].projectId" type="text"/>

I've tried ' and " and differnet combinations of <c:set..> and <c:out...> but nothing helps.

For html form input I found it looks like
<input type="text" name="<c:out value='project[${loop.index}].projectId'/>"/> and this will look corectly but if I try to use it in a stripes tag like

<stripes:text name="<c:out value='project[${loop.index}].projectId'/>"/>

it fails again even more so - looks like:

<input name="<c:out value='project[${loop.index}].projectId'/>" type="text"/>

What am I doing wrong?

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

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

发布评论

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

评论(2

奶茶白久 2025-01-13 19:02:31

应该可以,你可以试试

<stripes:text name="project['${loop.index}'].projectId"/>

It should work, can you try

<stripes:text name="project['${loop.index}'].projectId"/>
罪#恶を代价 2025-01-13 19:02:31

您的网络容器是什么?它的版本是什么?
根据您的需要,在将参数传递给 Stripes 标签之前,EL 操作必须由 Web 容器完成。

我不确定是否可以在 text 标记的 name 属性中使用表达式。

直接选择 Tomcat 6+

What is your web-container, and what is its version?
For your need EL manipulation must be done by the web container, before passing parameters to Stripes tags.

And I'm not sure whether it is possible to use expressions in name attribute of text tag.

Jost go for Tomcat 6+

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