熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

代碼實例:JSP分頁源程序

2022-06-13   來源: JSP教程 

  <%@ page contentType="text/html; charset=gb" language="java"%>

  <%@ page import = "javautil*"%>
<%@ page import = "javaio*"%>
<%@ page import = "javasql*"%>
<html>
<head>
<title>教師信息查詢</title>
<style type="text/css">
<!
style {
 fontfamily: "華文行楷";
 color: #FFFFFF;
}
>
</style>
<link href="defaultcss" rel="stylesheet" type="text/css">
<style type="text/css">
<!
style {
 color: #;
 fontsize: px;
}
style {fontsize: px}
>
</style>
</head>
<body bgcolor="#ffffff">
<%sessiongetAttribute("a_name");%>
<h align="center" class="style style style">教師信息查詢</h>
<hr />
<jsp:useBean id="tmessgeBean" scope="page" class="computersqlbean"/>
<table width="%" border="" cellpadding="" cellspacing="">
<tr align="center" bgcolor="#FFFF">
<td colspan="" bgcolor="#" class="style"><div align="right"><a href="indexhtml">返回首頁</a></div></td>
</tr>
<tr align="center" bgcolor="#">
  <td class="style">教號</td>
  <td class="style">姓名</td>
  <td class="style">系別</td>
  <td class="style">專業</td>
  <td class="style">操作選項</td>
</tr>
<%
requestsetCharacterEncoding("gb");
int nowPages;//當前頁
int pages;//請求頁數
int countPerPage = ; //每頁顯示條數
int pageCount;//總頁數
int recordCount=tmessgeBeangetCounter("select count(*) from dysf_teacher ");

  pageCount = (int)Mathceil((recordCount + countPerPage) / countPerPage);//算出總頁數
if(requestgetParameter("pages") == null){

  pages = ;
}else{
pages = new Integer(requestgetParameter("pages"))intValue();
}


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20619.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.