这是我的代码,为什么它不能显示我第一次上传的数据呢?它只从第二个开始
<%@ page contentType="text/html; charset=GBK" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="demo.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:326px;
top:18px;
width:539px;
height:90px;
z-index:1;
}
#Layer2 {
position:absolute;
left:89px;
top:134px;
width:1044px;
height:25px;
z-index:2;
}
#Layer3 {
position:absolute;
left:215px;
top:179px;
width:758px;
height:696px;
z-index:3;
background-color: #CCFFFF;
}
#Layer4 {
position:absolute;
left:793px;
top:880px;
width:90px;
height:31px;
z-index:4;
}
.STYLE1 {
font-size: 24px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<div id="Layer1">
<table width="539" height="76" border="1" bordercolor="#0000FF">
<tr>
<td bordercolor="#0033FF"><div align="center">
<%
int pagesize=1; //每页显示的数据数量
//下边两个变量是把动态生成的部分集中在一起放入页面
//这样做的好处是当修改页面时就可以直接用Dreamweaver来编辑了
StringBuffer userInfo=new StringBuffer();
StringBuffer pageInfo=new StringBuffer();
ResultSet rs = null; //数据库查询结果集
Connection conn = null;
Statement stmt = null;
try {
conn = DBConnection.getConnection();
conn.setAutoCommit(true);
//建立Statement对象并设置指针可前后移动
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE ,
ResultSet.CONCUR_READ_ONLY);
}catch(Exception e) {
System.err.println("数据库连接错误: " + e.getMessage());
}
//通过Statement执行SQL语句来获得查询结果
try{//从表userInfo中取出数据
rs = stmt.executeQuery("select * from new");
}catch(SQLException ex){
System.err.println("数据库查询错误: "+ex);
}
//从用户的请求中获取当前页码
//获得需要显示的页,如果用户请求没有页码参数,则默认是第1页
String paramPage=request.getParameter("page");
int currentPage=1;
try{
currentPage=Integer.parseInt(paramPage);
}catch(Exception e){
currentPage=1;
}
//将要显示的当前页的数据记录放入userinfo中
rs.last(); //把指针置底
int totaluser=rs.getRow(); //获得结果数量
//计算出总页数
int pagecount=(int)Math.ceil((float)totaluser/(float)pagesize);
int i=1;
rs.absolute((currentPage-1) * pagesize + 1); //把指针放到要显示的第一个数据
//把结果放进变量userInfo
while(i<=pagesize && rs.next()){
//userInfo.append("<tr bgcolor=#ffffff>\n");
/*userInfo.append("<td align=center>"+rs.getString("id")+"</td>");
userInfo.append("<td align=center>"+rs.getString("username")+"</td>");
userInfo.append("<td>"+rs.getString("phone")+"</td>");
userInfo.append("<td>"+rs.getString("email")+"</td>");
userInfo.append("</tr>");*/
out.println("<h3>"+"标题:"+"</h3>");
out.print("<h1>"+rs.getString(1)+"</h1>");
%>
</div></td>
</tr>
</table>
</div>
<div id="Layer2"><hr color="#6666FF" size="5" width="900" noshade="noshade"></div>