即使在foreach标记中,ID也不会更改其值

时间:2016-02-27 16:59:13

标签: jsp

我有list,其中包含一些用户。

<c:foreach>我正在迭代列表并获取对象。

现在我想删除用户idUser

问题是代码中的第二个p.getIdUser()总是返回列表中第一个元素的ID。

我找不到原因?

我的代码:

<c:forEach items="${liste}" var="p" >
     <tr>
        <td>${p.getIdUser()}</td>
        <td>${p.getNom()}</td>
        <td>${p.getPrenom()}</td>
        <td>${p.getCin()}</td>
        <td>${p.getPassword()}</td>   
        <td>${p.getDateEnt()}</td> 
        <td>${p.getGrade()}</td> 
        <td>${p.getEmail()}</td> 
        <td>${p.getTel()}</td> 
        <td>${p.getAdr()}</td> 
        <td>${p.getRole()}</td> 
        <td>${p.getCodeSite()}</td> 
        <td>
            <a href="user.html"><i class="fa fa-pencil"></i></a>
            <a href="#myModal" role="button" data-toggle="modal"><i class="fa fa-trash-o"></i></a>
        </td>                         
     </tr>

    <div class="modal small fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h3 id="myModalLabel">Delete Confirmation</h3>
                </div>
                <div class="modal-body">
                    <p class="error-text"><i class="fa fa-warning modal-icon"></i>Are you sure you want to delete the user?<br>This cannot be undone.</p>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
                    <a href='DeleteUser?id=${p.getIdUser()}'> <button class="btn btn-danger">Delete</button></a>
                </div>
            </div>
        </div>
    </div>
</c:forEach>  

0 个答案:

没有答案