Spring MVC 复选框
我有一个列表,使用这种方法时一切正常,问题是这个列表很长。 我想做的就是在 half 或其他东西后面放一些 html 。
<form:checkboxes element="div" path="user.bags" items="${bags}" itemValue="id" temLabel="name" />
首先,有什么办法可以操纵这个列表吗?或者我必须循环遍历它?
当我循环浏览它时,它似乎正在做类似的事情。我是否走在正确的轨道上?
<c:forEach items="${bags}" var="bag" varStatus="status">
<form:checkbox path="user.bags[${status.index}]" value="{bag.id}" name="?"/>
</c:forEach>
任何答案都很好!
I've got a list and everything works fine when using this approach, the problem is that this list is very long.
What I want to do is to put some html after half or something.
<form:checkboxes element="div" path="user.bags" items="${bags}" itemValue="id" temLabel="name" />
First of all, is there any way to manipulate this list? or do I have to loop through it?
When I loop through it it seems like it is doing something like this. I'm I even on the right track here?
<c:forEach items="${bags}" var="bag" varStatus="status">
<form:checkbox path="user.bags[${status.index}]" value="{bag.id}" name="?"/>
</c:forEach>
Any answer is good!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我可能会传递两个列表,以便您指定 html。 checkboxes 标签只是创建 html ...要确切地了解它的作用,只需查看渲染的页面即可。
I would probably pass two lists so you then specify the html. The checkboxes tag just creates the html ... to see exactly what it does just view your rendered page.
使用 varStatus 对其进行模运算,然后使用任何首选数字来检查 C:if 条件,然后在每次出现此类情况时使用新列。
Use varStatus to do modulo operation on it and then use any preferred number to check in C:if condition and then on every such occurrence use new column.