<%@ page language="java"
import="cn.njcit.dao.*,cn.njcit.domain.*,java.util.*"
pageEncoding="gb2312"%>
<html>
<head>
<jsp:useBean id="dao" class="cn.njcit.dao.impl.StudentDaoImpl"
scope="request" />
</head>
<style>
body{
background-image: url(<%=request.getContextPath()%>/main/main1.png);
}
</style>
<body>
<h1 align="center"> 学生信息</h1>
<table align="center" width=80% border="1" cellspacing="0px" style="border-collapse:collapse" bordercolor="#404040" background="<%=request.getContextPath()%>/bgpicture/bg3.png">
<tr align="center">
<thead>
<tr align="center" >
<td width="10%">
学号
</td>
<td width="10%">
姓名
</td>
<td width="8%">
性别
</td>
<td width="10%">
院系
</td>
<td width="10%">
班级
</td>
<td width="11%">
入学年份
</td>
<td width="11%">
联系方式
</td>
<td width="13%">
家庭住址
</td>
<td width="10%">
备注
</td>
<td width="10%">
删除
</td>
</tr>
</thead>
<%
List list = dao.getStudents(); //得到学生列表
Student stu = null;
int currpage =1; //实际显示页数
int pagesize = 10; //一页显示的记录数
int pageCount = (list.size() + pagesize - 1) / pagesize; //总页数
int c = currpage;
%>
<tfoot>
<tr align="center">
<td colspan="10">
<br />
<a href="<%=request.getContextPath()%>/bussiness/showStudents.jsp?currpage=<%=1%>">首页</a>
<a href="<%=request.getContextPath()%>/bussiness/showStudents.jsp?currpage=<%=currpage - 1%>">上一页</a>
<!-- <a href="<%=request.getContextPath()%>/bussiness/showStudents.jsp?currpage=<%=1%>">跳转到<input type="text" name="pages" size=1>页</a> -->
<a href="<%=request.getContextPath()%>/bussiness/showStudents.jsp?currpage=<%=currpage + 1%>">下一页</a>
<a href="<%=request.getContextPath()%>/bussiness/showStudents.jsp?currpage=<%=pageCount%>">末页</a>
共<%=pageCount%>页
</td>
</tr>
</tfoot>
<%
int i = 0;
for (i = 0; i < list.size(); i++)
{
stu = (Student) list.get(i);
if ((i + 1) >= ((currpage - 1) * 10 + 1) && i < (currpage * 10))
{
%>
<tbody>
<tr align="center">
<td>
<a
href="<%=request.getContextPath()%>/servlet/toEditStudent?id=<%=stu.getStuId()%>"><%=stu.getStuId()%></a>
</td>
<td>
<%=stu.getStuName()%>
</td>
<td>
<%=stu.getStuGender()%>
</td>
<td>
<%=stu.getStuDepartment()%>
</td>
<td>
<%=stu.getStuClass()%>
</td>
<td>
<%=stu.getStuStarYear()%>
</td>
<td>
<%=stu.getStuNumber()%>
</td>
<td>
<%=stu.getStuAddr()%>
</td>
<td>
<%=stu.getStuRes()%>
</td> <td>
<a
href="<%=request.getContextPath()%>/servlet/doDeleteStudent?id=<%=stu.getStuId()%>">删除</a>
</td>
</tr> <%
}
}
%>
</tbody>
</table> </body>
</html>
import="cn.njcit.dao.*,cn.njcit.domain.*,java.util.*"
pageEncoding="gb2312"%>
<html>
<head>
<jsp:useBean id="dao" class="cn.njcit.dao.impl.StudentDaoImpl"
scope="request" />
</head>
<style>
body{
background-image: url(<%=request.getContextPath()%>/main/main1.png);
}
</style>
<body>
<h1 align="center"> 学生信息</h1>
<table align="center" width=80% border="1" cellspacing="0px" style="border-collapse:collapse" bordercolor="#404040" background="<%=request.getContextPath()%>/bgpicture/bg3.png">
<tr align="center">
<thead>
<tr align="center" >
<td width="10%">
学号
</td>
<td width="10%">
姓名
</td>
<td width="8%">
性别
</td>
<td width="10%">
院系
</td>
<td width="10%">
班级
</td>
<td width="11%">
入学年份
</td>
<td width="11%">
联系方式
</td>
<td width="13%">
家庭住址
</td>
<td width="10%">
备注
</td>
<td width="10%">
删除
</td>
</tr>
</thead>
<%
List list = dao.getStudents(); //得到学生列表
Student stu = null;
int currpage =1; //实际显示页数
int pagesize = 10; //一页显示的记录数
int pageCount = (list.size() + pagesize - 1) / pagesize; //总页数
int c = currpage;
%>
<tfoot>
<tr align="center">
<td colspan="10">
<br />
<a href="<%=request.getContextPath()%>/bussiness/showStudents.jsp?currpage=<%=1%>">首页</a>
<a href="<%=request.getContextPath()%>/bussiness/showStudents.jsp?currpage=<%=currpage - 1%>">上一页</a>
<!-- <a href="<%=request.getContextPath()%>/bussiness/showStudents.jsp?currpage=<%=1%>">跳转到<input type="text" name="pages" size=1>页</a> -->
<a href="<%=request.getContextPath()%>/bussiness/showStudents.jsp?currpage=<%=currpage + 1%>">下一页</a>
<a href="<%=request.getContextPath()%>/bussiness/showStudents.jsp?currpage=<%=pageCount%>">末页</a>
共<%=pageCount%>页
</td>
</tr>
</tfoot>
<%
int i = 0;
for (i = 0; i < list.size(); i++)
{
stu = (Student) list.get(i);
if ((i + 1) >= ((currpage - 1) * 10 + 1) && i < (currpage * 10))
{
%>
<tbody>
<tr align="center">
<td>
<a
href="<%=request.getContextPath()%>/servlet/toEditStudent?id=<%=stu.getStuId()%>"><%=stu.getStuId()%></a>
</td>
<td>
<%=stu.getStuName()%>
</td>
<td>
<%=stu.getStuGender()%>
</td>
<td>
<%=stu.getStuDepartment()%>
</td>
<td>
<%=stu.getStuClass()%>
</td>
<td>
<%=stu.getStuStarYear()%>
</td>
<td>
<%=stu.getStuNumber()%>
</td>
<td>
<%=stu.getStuAddr()%>
</td>
<td>
<%=stu.getStuRes()%>
</td> <td>
<a
href="<%=request.getContextPath()%>/servlet/doDeleteStudent?id=<%=stu.getStuId()%>">删除</a>
</td>
</tr> <%
}
}
%>
</tbody>
</table> </body>
</html>
解决方案 »
- 随机显示数据问题
- 覆盖导出工程的.class
- 如何改变jsp上传文件的 浏览 按钮
- 为什么我用FileOutputStream后close了,还不能renameto
- WEB-INF下的web.xml导致404找不到页面错误???????
- 困惑已久的简单的连接池问题,在线等....
- JAVA反编译工具为什么反编译完,有try{}catch{}的部分都有问题,无法编译通过,如反编译出2个return来……
- 请教在js中进行用户输入验证?
- 网页打开的速度很慢,请问可能是什么问题
- java.lang.OutOfMemoryError
- src图片显示不出来
- weblogic下axis调用webservice异常
int currpage =1; //实际显示页数
int pagesize = 10; //一页显示的记录数String cpage = request.getParameter("currpage");
if(cpage !=null){
currpage = Integer.parseInt(cpage);
}
int currpage =1; //实际显示页数
int pagesize = 10; //一页显示的记录数