Stripes 包裹表单输入不会计算 c:foreach 的 Loop.index 值
我所做的一切就像在 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.. 作为 而不是
我尝试过 ' 和 " 以及
和
但
对于 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
应该可以,你可以试试
It should work, can you try
您的网络容器是什么?它的版本是什么?
根据您的需要,在将参数传递给 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+