静止的流水的学习日志
静止的流水
全部博文(210)
Windows(1)
Linux(31)
2011年(34)
2010年(121)
2009年(37)
2008年(18)
cynthia
wojiuzhu
jd_lzh
鄙人姓王
Jack_Tan
fanbiubi
猜我咯
aaccp1
chrisy52
分类: Mysql/postgreSQL
2009-12-10 10:34:19
<%!String start;%><%!int prepage;%><%!int nextpage;%><%start =request.getParameter("st"); int st = Integer.parseInt(start);prepage = st - 10;nextpage = st+10; String driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://localhost:3306/medicine"; String user = "root"; String password = "hello"; try { Class.forName(driver); Connection conn = DriverManager.getConnection(url, user, password); Statement statement = conn.createStatement(); String sql = "select * from bbs order by time desc limit "+st+",10"; ResultSet rs = statement.executeQuery(sql); out.println("100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"); out.println(""); String name = null; while(rs.next()) { out.println("+rs.getString("href")+" target=\"_blank\">"+rs.getString("title")+""); out.println("overhide80\">"+rs.getString("source")+""); out.println(""+rs.getString("time")+""); } rs.close(); conn.close(); }catch(ClassNotFoundException e) { out.println("error,class not found"); e.printStackTrace(); } catch(SQLException e){ e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } out.println("");%><div class="p"><a href=morebbsnews.jsp?st=<%=prepage%>&nd=10>上一页</a><a href=morebbsnews.jsp?st=0&nd=10>[1]</a> <a href=morebbsnews.jsp?st=10&nd=10>[2]</a> <a href=morebbsnews.jsp?st=20&nd=10>[3]</a> <a href=morebbsnews.jsp?st=30&nd=10>[4]</a> <a href=morebbsnews.jsp?st=40&nd=10>[5]</a> <a href=morebbsnews.jsp?st=50&nd=10>[6]</a> <a href=morebbsnews.jsp?st=60&nd=10>[7]</a> <a href=morebbsnews.jsp?st=70&nd=10>[8]</a> <a href=morebbsnews.jsp?st=80&nd=10>[9]</a> <a href=morebbsnews.jsp?st=90&nd=10>[10]</a> <a href=morebbsnews.jsp?st=<%=nextpage%>&nd=10>下一页</a></div><br>;</body></html>
上一篇:linux定时运行命令
下一篇:vim小技巧
登录 注册