在 forEach 中添加 form:checkbox
我在 jsp 中有一个表,我向其中添加了值,如下所示
<c:forEach items="${features}" var="feature">
<c:choose>
<c:when test="${feature.present == true}">
<c:set var="featurePresent" value="REMOVE"/>
</c:when>
<c:otherwise>
<c:set var="featurePresent" value="ADD"/>
</c:otherwise>
</c:choose>
<tr>
<td>${feature.name}</td>
<td>${featurePresent}</td>
<td><form:checkbox path="" value=""/></td>
</tr>
</c:forEach>
我正在尝试添加复选框..
我的要素类是
class Feature{
private String name;
private boolen present;
private boolean checkbox
}
如何在 jsp 页面中设置复选框
I have a table in a jsp and i add the value to it as follows
<c:forEach items="${features}" var="feature">
<c:choose>
<c:when test="${feature.present == true}">
<c:set var="featurePresent" value="REMOVE"/>
</c:when>
<c:otherwise>
<c:set var="featurePresent" value="ADD"/>
</c:otherwise>
</c:choose>
<tr>
<td>${feature.name}</td>
<td>${featurePresent}</td>
<td><form:checkbox path="" value=""/></td>
</tr>
</c:forEach>
I am trying to add the checkbox ..
My Feature class is
class Feature{
private String name;
private boolen present;
private boolean checkbox
}
How can i set the checkbox in the jsp page
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您的命令对象有一个
List; features
属性,并且您希望在提交表单时列表中每个功能对象的复选框状态。您可以尝试:I am assuming your command object has a
List<Feature> features
property and you want the checkbox state for each Feature object in the list when you submit the form. You may try: