日期:2014-05-16  浏览次数:20745 次

自己写的历史查询(mysql)加分页
//样式和数据库的列名都是对照实际的,所以不能通用,不过可以看出怎么做了

<%@ page language="java" pageEncoding="UTF-8"%>

<%@page import="java.sql.*"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
   
<style>
body{font-size:12px;letter-spacing:1px;}
input{vertical-align:text-bottom;}
.tbDiv{margin:0 auto;width:775px}
.tb{border:1px solid #88DAFD;line-height:24px;width:100%}
.tb tr td{border-bottom:1px solid #ccc;text-align:center}
.tbHead{background:#E0F4FF;color:#0B9CD9}

.searchItem{border:1px solid #88DAFD}
.searchItem .tbHead{line-height:24px;border-bottom:1px solid #88DAFD}
.searchContainer{padding:10px;}
.searchInput{border:1px solid #4EC6F9}
.even{background:#F9F9F9}

.tb2{border:1px solid #88DAFD;line-height:24px;width:410px;text-align:left}
.tb2 tr td{border-right:1px solid #ccc;border-bottom:1px solid #ccc;text-align:center}
.tb2 .tbHead{text-align:left}

.mbm{background:url(../images/siOrder/ico.gif) -515px -40px;height:14px;width:12px;display:block;}
.mbm1{background:url(ico.gif) -563px -40px;height:14px;width:12px;display:block;}
.mbm2{background:url(ico.gif) -587px -40px;height:14px;width:12px;display:block;}
.mbm3{background:url(ico.gif) -587px -40px;height:14px;width:12px;display:block;}
.mbm4{background:url(ico.gif) -1786px -2px;height:24px;width:24px;display:block;}
.mbm6{background:url(../images/siOrder/ico.gif) -2117px -10px;height:12px;width:15px;display:block;}
.mbm7{background:url(../images/siOrder/ico.gif) -2144px -10px;height:12px;width:12px;display:block;}

.jiantou {/*display:inline-block;*/display:none;border:0 solid #fff;border-width:3px 3px 0;border-color:#090 #fff;width:0;height:0;overflow:hidden;cursor: pointer;color:#0B9CD9}
</style>
  </head>
 
  <body>

<table id="tbView" class="tb" cellpadding="0" cellspacing="0">
<tr class="tbHead">
<!-- <td width="6%">ID</td> -->
  <td width="12%">订单号</td>
  <td width="18%">旅客名</td>
  <td width="15%">下订时间</td>
  <td width="9%">订购/退(张)</td>
  <td width="10%">金额(元)</td>
<td width="5%"><span onclick="">类型</span><span class="jiantou"></span></td>
  <td width="10%"><span onclick="">支付方式</span><span class="jiantou" onclick=""></span></td>
  <!-- <td width="3%">新单</td> -->
  <td width="6%"><span onclick="">订票<br/>状态</span><span class="jiantou" onclick=""></span></td>
  <td width="5%"><span onclick="">申请<br/>退票</span><span class="jiantou" onclick=""></span></td>
  <td width="10%">订单<br/>备注</td>
  </tr>
 
 
  <%
 

  Connection conn;
  PreparedStatement stat;
  String url="jdbc:mysql://localhost:3306/xinnuo";
  String user="root";
  String password="root";
 

  Class.forName("com.mysql.jdbc.Driver");
 
 
  conn=DriverManager.getConnection(url,user,password);
  String s="select * from si_order_main_history";
     stat=conn.prepareStatement(s);
ResultSet result=stat.executeQuery();

 
int intPageSize; //一页显示的记录数 
int intRowCount; //记录总数 
int intPageC