| |
| |
<%Connection sqlcn=null;
Statement sqlst=null;
ResultSet sqlrs=null;
/*初始化类*/%>
<%/*判断本页是否已经取过数据,如没有,连接数据库取*/
if(session.getAttribute("DATA")==null)
{%>
<%
try
{
int i=0;
int j=0;
Class.forName(driver);
sqlcn = DriverManager.getConnection(DBURL,user,password);
sqlst = sqlcn.createStatement();
String sqlString ="select * from GE_COR_BASE_INFO ";
String[][] data=new String[500][5];
sqlrs=sqlst.executeQuery(sqlString);
while(sqlrs.next())
{
data[i][0]=sqlrs.getString("id");
data[i][1]=sqlrs.getString("corporation_name");
data[i][2]=sqlrs.getString("communication_address");
data[i][3]=sqlrs.getString("telephone_exchange_control");
i++;
}
sqlrs.close();
sqlst.close();
sqlcn.close();
session.setAttribute("DATA",data);
String he=Integer.toString(i);
session.setAttribute("I",he);
}
catch (ClassNotFoundException ex)
{
System.err.println("ClassNotFoundException: " +
ex.getMessage());
}
%>
<%}%>
<%
String[][] data1 =new String[500][5];
data1=(String[][])session.getAttribute("DATA");
int n=0;
n=Integer.parseInt((String)session.getAttribute("I"));
int irip=30; //每页的行数
int totalpage=0; //总页数
int allrow=n; //记录总数
%>
<%
if(allrow<1)
{out.println("对不起!数据库中没有满足您查询条件的数据");}
//没有数据
else{
int x=0;
int nowpage=0;//本页是第几页
int y=0;//由当前页号决定的一个int
try{ totalpage=allrow/irip;
if((totalpage*irip)
|
发电企业名称
|
通讯地址
|
联系电话
|
<%
if(nowpage==1)
{y=0;
}
if(nowpage>1)
{y=(nowpage-1)*irip;}
if(nowpage<0||nowpage>totalpage)
{
out.println("没有你要显示的页");
}///提示错误,页面加数字教
for( int m=y;m
|
|
|
<%
}
%>
|
|