1、侧边栏固定不滚动:在body中添加样式!
<%--在body上可以添加一些布局样式效果:固定侧边栏,侧边栏缩小后显示迷你版,页脚固定,导航固定--%><body class="layout-fixed sidebar-mini layout-footer-fixed layout-navbar-fixed ">
2、使用jstl动态加载后台的域对象数据:
提前导入jstl依赖:
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
后台控制器代码:
@RequestMapping("list")
public String userList(Model model) {
List<User> all = userService.findAll();
System.out.println(all);
model.addAttribute("userList", all);
return "page_user_list";
}
前端代码:遍历
<tbody>
<c:forEach items="${userList}" var="user">
<tr>
<td>${user.id}</td>
<td>${user.username}</td>
<td>${user.password}</td>
<td>${user.phone}</td>
<td>${user.created}</td>
</tr>
</c:forEach>
</tbody>
使用jstl要添加页面的声明:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>