<form:checkboxes>数据回显问题

来源:互联网 发布:南京四维星软件 编辑:程序博客网 时间:2024/05/21 17:20

<form:checkboxes items="${list}" path="${path}" />

items要求为集合,是所有选择框的选项

path也要求为集合,是所有已选择框的选项

checkboxes 得到的数据是集合,数据库保存的是字符串,所以需要手动转


例:

修改表单用这个,z为集合类型,如果是字符串类型,则只有一个选项打钩

<c:if test = "${not empty first.d}">
<form:checkboxes path="z" items="${fns:getDictList('d')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required"/>
</c:if>

新增表单用这个,d为String类型,如果是集合类型,则直接报错
<c:if test = "${empty first.d}">
<form:checkboxes path="d" items="${fns:getDictList('d')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required"/>
</c:if>


至于直接都用集合类型为什么报错,还没搞懂..

0 0