質問

I make a form that have checkbox, when the value of checkbox was store in database, when I try to show the field of my data base in to display table (jsp), I got this Ljava.lang.String;@1fb8702 on the field of my checkbox value,

this is part of my 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>

this is my jps of my checkbox :

<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>

any help will be pleasure :)

役に立ちましたか?

解決

request.getPameterValues("sub_menu_user") will give an array of upto 3 values.

<td>
    <c:forEach var="u" items="${row.sub_menu_user}">
        ${u}
    </c:forEach>
</td>
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top