📄 viewuser1.jsp
字号:
<%@ page language="java" pageEncoding="GB18030"%>
<%@page
import="page.test.pagebean.PageBean,java.util.List,java.util.Iterator,page.test.entity.User"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@page
import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="page.test.service.UserService"%>
<%@page
import="org.springframework.context.support.ClassPathXmlApplicationContext"%>
<%@page import="java.lang.Integer;"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
<head>
<html:base />
<title>分页查询</title>
</head>
<body>
<center>
<table border="1">
<tr>
<td width="100">
UserId
</td>
<td width="100">
UserName
</td>
<td width="100">
PassWord
</td>
</tr>
<%
ApplicationContext ac = new ClassPathXmlApplicationContext(
"applicationContext.xml");
UserService us = (UserService) ac.getBean("service");
PageBean pb=(PageBean)request.getAttribute("pb");
if(pb==null){
pb = (PageBean) us.queryForPage(1, 2);
}
List list = pb.getList();
Iterator it = list.iterator();
while (it.hasNext()) {
User user = (User) it.next();
%>
<tr>
<td>
<%=user.getId()%></td>
<td>
<%=user.getUsername()%></td>
<td>
<%=user.getPassword()%></td>
<%
}
%>
</tr>
<tr>
<td colspan="3" align="center">
共<%=pb.getAllRows()%>条记录,共<%=pb.getTotalPage()%>页,每页<%=pb.getPageSize()%>条记录
<a href="<%=request.getContextPath()%>/userListAction.do?page=1">首页</a>
<a
href="<%=request.getContextPath()%>/userListAction.do?page=<%=(pb.getCurrentPage() == 1 )? 1 : (pb.getCurrentPage()-1)%>">上一页</a>
<a href="<%=request.getContextPath()%>/userListAction.do?page=<%=(pb.getCurrentPage() == pb.getTotalPage()) ? pb.getTotalPage() : (pb.getCurrentPage()+1)%>">下一页</a>
<a
href="<%=request.getContextPath()%>/userListAction.do?page=<%=pb.getTotalPage()%>">尾页
</a>
</td>
</tr>
</table>
</center>
</body>
</html:html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -