Basic introduction of 04.AdminLTE
Basic introduction 05.SSM integration case
08. Access Control
09. User Action
10. Control permissions associated with
11.AOP log
09. User Action
1. The user operation - all user queries
3.3.1. The user query page user-list.jsp
See the specific code in the data
<!--数据列表--> <table id="dataList" class="table table-bordered table-striped table-hover dataTable"> <thead> <tr> <th class="" style="padding-right: 0px"><input id="selall" type="checkbox" class="icheckbox_square-blue"> </th> <th class="sorting_asc">ID</th> <th class="sorting_desc">用户名</th> <th class="sorting_asc sorting_asc_disabled">邮箱</th> <th class="sorting_desc sorting_desc_disabled">联系电话</th> <th class="sorting">状态</th> <th class="text-center">操作</th> </tr> </thead> <tbody> <c:forEach items="${userList}" var="user" varStatus="s"> <tr> <td><input name="ids" type="checkbox" id="${s.index}" value="${user.id}"></td> <td>${user.id }</td> <td>${user.username }</td> <td>${user.email }</td> <td>${user.phoneNum }</td> <td>${user.statusStr }</td> <td class="text-center"> <a href="${pageContext.request.contextPath}/user/findById.do?id=${user.id}" class="btn bg-olive btn-xs">详情</a> <a href="${pageContext.request.contextPath}/user/findUserByIdAndAllRole.do?id=${user.id}" class="btn bg-olive btn-xs">Add Role </ A > </ TD > </ TR > </ C: forEach > </ tbody >
View layer UserController
@Controller @RequestMapping (value = "/ User" ) public class the UsersController { @Autowired Private IUserService that userService; @RequestMapping ( "/findAll.do" ) public ModelAndView the findAll () throws Exception { ModelAndView Music Videos = new new ModelAndView ( "User-List2 " ); // get a target add List <the UserInfo> userList = userService.findAll (); // attributeName EL expression depends on jsp pages {} string inside mv.addObject (" userList " , userList); return mv; } }
UserServiceImpl
The newly added part of the code:
// 查询所有用户 @Override public List<UserInfo> findAll() throws Exception { return userDao.findAll(); }
Persistence IUserDao
The newly added part of the code:
/** * 查询所有用户 * @return * @throws Exception */ @Select("select * from USERS") public List<UserInfo> findAll() throws Exception;
user-list.jsp inside a skip request button control achieved by onclick
<!--工具栏--> <div class="pull-left"> <div class="form-group form-inline"> <div class="btn-group"> <button type="button" class="btn btn-default" title="新建" onclick="location.href='${pageContext.request.contextPath}/pages/user-add.jsp'"> <i class="fa fa-file-o"></i><>Button</New button type="button" class="btn btn-default" title="刷新"> <i class="fa fa-refresh"></i> 刷新 </button> </div> </div> </div>
user-add.jsp which key information is as follows:
form form's action attribute
<! - Content header / -> < form Action = "$ {} /user/save.do pageContext.request.contextPath" Method = "POST" > <! - the body area ->
====================
end