效果:前端
就是一個 jsp for循環,在頁面展現java
源碼: 後端
<head> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> //引入標籤庫 <title>用戶列表</title> </head> <nav class="navbar navbar-default" role="navigation"> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li class="dropdown"> <form class="navbar-form navbar-left" role="search"> <div class="form-group"> <input type="text" name="findContent" id="findContent" placeholder="輸入暱稱 / 賬號" class="form-control"/> </div> <button type="submit" class="btn btn-primary">查詢</button> <button type="button" id="deleteAll" class="btn btn-danger">Delete</button> </form> </li> </ul> </div> </nav> <table class="table table-bordered"> <thead> <tr> <th><input type="checkbox" id="checkAll" disabled autocomplete="off"/></th> <th>暱稱</th> <th>Email/賬號</th> <th>登陸狀態</th> <th>建立時間</th> <th>最後登陸時間</th> <th>操做</th> </tr> </thead> <c:forEach items="${us}" var="c" varStatus="stc"> <tr> <td><input value="" check='box' type="checkbox" /></td> <td>${c.nickname}</td> <td>${c.email}</td> <td>${c.status}</td> <td>${c.create_time}</td> <td>${c.last_login_time}</td> <td> <c:if test="${c.status=='1'}"> <button type="button" class="btn btn-warning Disable" >禁用</button> </c:if> <c:if test="${c.status=='0'}"> <button type="button" class="btn btn-success activation" >激活</button> </c:if> <button type="button" class="btn btn-danger delete" >刪除</button> </td> </tr> </c:forEach> </table>