站内搜索: 请输入搜索关键词

当前页面: 开发资料首页JSP 专题如何用Jsp读取Mysql数据库

如何用Jsp读取Mysql数据库

摘要: 如何用Jsp读取Mysql数据库


<%//说明count是总的记录的条数
//page是用户提交的参数,用于控制分页的,允许的值是正整数,负整数
int i=count/15; //总页,每页显示15条记录
int j=i/10; //总的大页 ,没10个页面分一大页
//Page 显示的页面
int StartPage;
//int HrefPage;
if (Page<0) Page=0-Page*10; //10页分一次
StartPage=Page/10; //10页分一次
out.print ("[共有"+i+"页]");
//out.print ("共有"+j+"屏");
//out.print ("显示第"+Page+"页");
//out.print ("StartPage="+StartPage);
if (StartPage>0)
out.print ("|前10页");
for (int k=0;k<10;k++)
{ int p=StartPage*10+k;
if (p>i) break;
if (p==Page)
out.print ("|第"+Integer.toString(p+1)+"页");
else
out.print ("|第"+Integer.toString(p+1)+"页");
}
if (StartPage out.print ("|后10页");
out.print ("|");
%>



↑返回目录
前一篇: 如何使用JSP访问MySQL数据库
后一篇: 打开页面就是全屏的方法