锘??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美天天综合网,天堂√在线中文官网在线,ww久久综合久中文字幕http://www.aygfsteel.com/a394200856/java zizizh-cnSun, 06 Jul 2025 14:15:23 GMTSun, 06 Jul 2025 14:15:23 GMT60鐢≒repareStatement鏂規(guī)硶鐨勭函JSP鐗堝垎欏碉紙Mysql鏁版嵁搴擄級http://www.aygfsteel.com/a394200856/archive/2012/01/10/368264.html鑳栧瓙superzizi鑳栧瓙superziziTue, 10 Jan 2012 13:50:00 GMThttp://www.aygfsteel.com/a394200856/archive/2012/01/10/368264.htmlhttp://www.aygfsteel.com/a394200856/comments/368264.htmlhttp://www.aygfsteel.com/a394200856/archive/2012/01/10/368264.html#Feedback0http://www.aygfsteel.com/a394200856/comments/commentRss/368264.htmlhttp://www.aygfsteel.com/a394200856/services/trackbacks/368264.html
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!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>JSP鐗堝垎欏?lt;/title>
</head>
<body>
<%!   int pagecount;  // pagecount涓烘婚〉鏁?nbsp;
int  pagesize=3;%>  <%-- pagesize涓烘瘡欏墊樉紺虹殑璁板綍鏁?--%>
<%  Connection  con;
    Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost/qinshi","root","007");
String  sql="select  * from wowo order by  id";
PreparedStatement ps=con.prepareStatement(sql,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet  rs=ps.executeQuery();
rs.last();
int  count=rs.getRow();  //count涓鴻褰曟繪暟
int i=0; 
int pageI=1 ;
pagecount=(count%pagesize==0)?(count/pagesize):(count/pagesize+1);
%>
<%  
String pages=request.getParameter("nowpage");
if(pages==null)
 pages="1";
   try{
        pageI = Integer.parseInt(pages);
    }
    catch (NumberFormatException e){
       pageI = 1;
    }
if(pageI<0||pageI>pagecount)
{ pageI=pagecount;}
int position=(pageI-1)*pagesize +1;
rs.absolute(position);
%>
<table border="1"  cellpadding="0" cellspacing="0"><tr>
<th>id</th> 
<th>users</th> </tr>
<%
while(i<pagesize&&!rs.isAfterLast()){
%>
<tr>
<td><%=rs.getString(1)%></td> 
<td><%=rs.getString(2)%></td>
</tr>
<%rs.next();i++; }%>
</table>
<form method="get" action="">
<table>
<tr>
<td><a href="fenye.jsp?nowpage=1">絎竴欏?lt;/a></td>
<td><% if(pageI<pagecount){%>
<a href="fenye.jsp?nowpage=<%=pageI+1 %>">涓嬩竴欏?lt;/a><%}%></td>
<td><% if(pageI>1){%>
<a href="fenye.jsp?nowpage=<%=pageI-1 %>">涓婁竴欏?lt;/a><%}%></td>
<td><a href="fenye.jsp?nowpage=<%=pagecount %>">灝鵑〉</a></td>
<td><input type="text" name="nowpage" /></td>
<td><input type="submit" name="submit"  value="go"/></td></tr>
</table>
</form>
</body>
</html>


鑳栧瓙superzizi 2012-01-10 21:50 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 哈密市| 化德县| 乌鲁木齐县| 利津县| 永胜县| 涞水县| 昌黎县| 孟津县| 安陆市| 镇雄县| 普格县| 康定县| 德格县| 白玉县| 盐津县| 台山市| 齐河县| 丰县| 化隆| 湟中县| 凤庆县| 上饶市| 巴彦淖尔市| 宁津县| 富阳市| 施甸县| 上虞市| 昌江| 修武县| 昌吉市| 石台县| 香格里拉县| 邳州市| 开远市| 阳城县| 蛟河市| 浦城县| 清丰县| 高要市| 宜城市| 化州市|