锘??xml version="1.0" encoding="utf-8" standalone="yes"?>精品国产第一国产综合精品,五月天激情综合网,日韩精品福利http://www.aygfsteel.com/a394200856/java zizizh-cnSun, 06 Jul 2025 08:19:02 GMTSun, 06 Jul 2025 08:19:02 GMT60鐢≒repareStatement鏂規硶鐨勭函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 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 广灵县| 奇台县| 夏河县| 任丘市| 平果县| 涞源县| 利津县| 新邵县| 麻城市| 建始县| 蕉岭县| 娄底市| 博乐市| 喜德县| 鄯善县| 龙里县| 县级市| 毕节市| 内江市| 木兰县| 曲麻莱县| 康定县| 桐乡市| 贵德县| 衡阳县| 朝阳县| 乐至县| 山东| 石狮市| 万州区| 托克逊县| 上饶市| 梁河县| 疏勒县| 鲜城| 河津市| 怀安县| 庄河市| 洮南市| 霞浦县| 普兰店市|