我制作了一个有复选框的表单, 当checkbox的值存储在数据库中时, 当我试图将我的数据库的字段显示在显示表(jsp)中时, 我在复选框值
的字段上得到了Ljava.lang.String;@1fb8702
这是我的jsp的一部分,
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered"
id="example">
<thead>
<tr>
<th>
<spring:message code="authority" text="default text"/>
</th>
<th>
<spring:message code="authorityName" text="default text"/>
</th>
<th>
<spring:message code="menu" text="default text"/>
</th>
<th>
<spring:message code="sub_menu_user" text="default text"/>
</th>
<th>
<spring:message code="sub_menu_monitoring" text="default text"/>
</th>
<th>
<spring:message code="sub_menu_parameter" text="default text"/>
</th>
<th>
<spring:message code="action" text="default text"/>
</th>
</tr>
</thead>
<tbody>
<c:forEach var="row" items="${requestScope.authorityuser}">
<tr>
<td>${row.id_authority}</td>
<td>${row.nama_authority}</td>
<td>${row.menu}</td>
<td>${row.sub_menu_user}</td>
<td>${row.sub_menu_monitoring}</td>
<td>${row.sub_menu_parameter}</td>
<input type="hidden" name="id_authority" value="${row.id_authority }">
<td><a href="#update" role="button" data-toggle="modal"
class="update" id_update="${row.id_authority}"
nama_authority="${row.nama_authority}" menu="${row.menu}"
sub_menu_user="${row.sub_menu_user}" sub_menu_monitoring="${row.sub_menu_monitoring}"
sub_menu_parameter="${row.sub_menu_parameter}"> <i class="icon-edit"></i>
<spring:message code="edit" text="default text"/>
</a><a href="#delete" role="button" data-toggle="modal"
class="delete" id_delete="${row.id_authority}">
<i class="icon-trash"></i>
<spring:message code="delete" text="default text"/>
</a></td>
</tr>
</c:forEach>
</tbody>
</table>
这是我的复选框的jps:
<tr>
<td>
<spring:message code="authority" text="default text"/>
</td>
<td>:</td>
<td><input type="text" name="id_authority" required></td>
</tr>
<tr>
<td>
<spring:message code="authorityName" text="default text"/>
</td>
<td>:</td>
<td><input type="text" name="nama_authority" required></td>
</tr>
<tr>
<td>
<spring:message code="authorityRight" text="default text"/>
</td>
<td>:</td>
<td><input type="checkbox" name="menu" value="user">User<br/>
<input type="checkbox" name="sub_menu_user" value="user1">User1
<input type="checkbox" name="sub_menu_user" value="user2">User2
<input type="checkbox" name="sub_menu_user" value="user3">User3<br/>
<input type="checkbox" name="menu" value="monitoring">Monitoring<br/>
<input type="checkbox" name="sub_menu_monitoring" value="monitoring1">Monitoring1
<input type="checkbox" name="sub_menu_monitoring" value="monitoring2">Monitoring2
<input type="checkbox" name="sub_menu_monitoring" value="monitoring3">Monitoring3<br/>
<input type="checkbox" name="menu" value="parameter">Parameter<br/>
<input type="checkbox" name="sub_menu_parameter" value="parameter1">Parameter1
<input type="checkbox" name="sub_menu_parameter" value="parameter2">Parameter2
<input type="checkbox" name="sub_menu_parameter" value="parameter3">Parameter3
</td>
</tr>
任何帮助都会很愉快:)
答案 0 :(得分:0)
request.getPameterValues("sub_menu_user")
将提供最多3个值的数组。
<td>
<c:forEach var="u" items="${row.sub_menu_user}">
${u}
</c:forEach>
</td>