河北省科技政策查询系统需求 一、项目背景说明: 近期,河北省省长视察河北省科技厅,需要开发一个科技政策查询界面,展示在河北省科技厅办公大厅触摸大屏上,实现多条件查询和按照政策分类树分类浏览。 二、项目功能说明: 科技政策查询主界面样式如下图所示: 主界面主要分成五部分: 1、顶部为LOGO区,主要展示科技技术情报研究院的LOGO,并用蓝黑色显示科技政策查询系统。 2、第二部分为多条件查询区,主要包括政策图解(按钮式超级链接),查询条件包括政策名称、政策文号、发文机构、全文检索四个查询条件,可以根据四个条件进行综合查询。 3、第三部分为左侧科技政策分类树形结构,要求从policy_kind科技政策分类表中读取科技政策分类属性,后面括号内标注的是属于这个分类的科技政策数量,政策数量的统计来源于科技政策数据库。点击相关的分类,右侧的政策接过去显示相应数量的科技政策列表。 4、第四部分为右侧政策查询结果显示区,显示科技政策查询结果列表,点击查看或者具体的政策名称,跳转到政策详细信息显示界面(如下图所示)。 查询结果列表包括政策名称、发文机构、颁布日期、政策分类、操作五项内容。 显示结果要求: (1)结果表标题政策名称包括政策名称、发文机构、颁布日期、政策分类、操作五个标题居中显示。 (2)政策名称、发文机构结果列表左对齐,颁布日期、政策分类、操作的结果列表居中显示。 (3)要求分页显示,按照图示要求。 5、底部的系统说明区:要求按照样式加载:Copyright 1996-2022 All Rights Reserved 版权所有:河北省科学技术情报研究院 河北省科技创新战略研究院 技术支持:河北省科技信息处理实验室。
最终做出来的效果,算是勉强能过关,代码有些许的小bug。
<%--index.jsp--%> <%@ page import="java.util.Map" %> <%@ page import="util.DbUtil" %> <%@ page import="java.util.List" %> <%@ page import="java.sql.*" %> <%@ page import="com.example.demo1.shuju" %> <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <!DOCTYPE html> <html> <head> <meta name="renderer" content="webkit"/> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>河北省科技政策查询系统</title> <link rel="stylesheet" href="style.css"> <style> body { font-family: Arial, sans-serif; } #header { background-color: white; color: #fff; text-align: center; padding: 10px; display: flex; align-items: center; justify-content: center; } #header img { height: 50px; margin-right: 10px; } #search-area { margin: 20px; text-align: center; align-items: center; justify-content: center; } #policy-tree { text-align: center; } table { margin: 20px auto; border-collapse: collapse; width: 80%; } th, td { padding: 10px; } th { background-color: #f2f2f2; } td { border-bottom: 1px solid #f2f2f2; } button { background-color: #007bff; color: white; padding: 8px 12px; border: none; border-radius: 4px; cursor: pointer; } button:hover { background-color: #45a049; } .pagination { margin-top: 20px; text-align: center; } input[type="text"] { width: 10%; padding: 10px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 5px; } input[type="submit"] { width: 5%; padding: 10px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 5px; } input[type="submit"] { background-color: #007bff; cursor: pointer; } </style> </head> <body> <div style="width: 100%;"> <h1 style="text-align: center;color: #030098"><img src="img/LOGO.png" style="width: 30px;height: 30px">河北省科技政策查询系统 </h1> </div> <div style="text-align: center"> <form method="post" action="search"> 政策名称 <input type="text" value="${c2}" placeholder="请输入政策名称" name="c2"> 发文字号 <input type="text" value="${c6}" placeholder="请输入发文字号" name="c6"> 发文机构 <input type="text" value="${c8}" name="c8"> 全文检索 <input type="text" value="${c19}" name="c19"> <input type="submit" value="查询"> </form> </div> <table border="1" style="text-align:center;"> <tr> <td align="center" width=400px>政策名称</td> <td align="center" width=300px>发文机构</td> <td align="center" width=200px>颁布日期</td> <td align="center" width=300px>政策分类</td> </tr> <% List<shuju> l = (List<shuju>) request.getAttribute("l2"); int pages = 0; //待显示页面 int count = 0; //总条数 int totalpages = 0; //总页数 int limit = 10; //每页显示记录条数 if (l != null) { count = l.size(); //由记录总数除以每页记录数得出总页数 totalpages = (int) Math.ceil(count / (limit * 1.0)); //获取跳页时传进来的当前页面参数 String strPage = request.getParameter("pages"); //判断当前页面参数的合法性并处理非法页号(为空则显示第一页,小于0则显示第一页,大于总页数则显示最后一页) if (strPage == null) { pages = 1; } else { try { // pages = java.lang.Integer.parseInt(strPage); pages=1; } catch (Exception e) { pages = 1; } if (pages < 1) { pages = 1; } if (pages > totalpages) { pages = totalpages; } } for (int j = limit+(pages-1)*limit; j<l.size()&&j <limit+(pages)*limit; j++) { %> <tr> <td align="center" title="<%=l.get(j).c2 %>"><a style="color:blue" href='show.jsp?q=<%=l.get(j).c1 %>' onclick="javascript:return del()"><%=l.get(j).c2 %> </a> </td> <td align="center"><%=l.get(j).c8 %> </td> <td align="center"><%=l.get(j).c9 %> </td> <td align="center"><%=l.get(j).c3 %> </td> </tr> <% } %> <%-- <form name="f1" method="POST" action="index.jsp" onSubmit="return checknum()">--%> <%-- <table border="0">--%> <%-- <tr>--%> <%-- <td>第<%=pages%>页 共<%=totalpages%>页 <a href="index.jsp?pages=1">首页</a></td>--%> <%-- <td><a href="index.jsp?pages=<%=(pages<1)?pages:(pages-1) %>"> 上一页</a></td>--%> <%-- <td><a href="index.jsp?pages=<%=(pages>=totalpages)?totalpages:(pages+1)%>"> 下一页</a></td>--%> <%-- <td><a href="index.jsp?pages=<%=totalpages%>">最后一页</a></td>--%> <%-- <td>共 <%=count%>条数据</a></td>--%> <%-- <td>转到第:<input type="text" name="page" size="8">页<input type="submit" value="前往" name="cndok">--%> <%-- </td>--%> <%-- </tr>--%> <%-- </table>--%> <%-- </form>--%> <% } else { %> <% Class.forName("com.mysql.jdbc.Driver"); // 2.使用我自己的数据库 test 获取链接 String url = "jdbc:mysql://localhost:3306/test"; String username = "root"; String password = "123456"; Connection connection = DriverManager.getConnection(url, username, password); //获取执行sql的对象statement Statement statement = connection.createStatement(); // int pages = 0; //待显示页面 // int count = 0; //总条数 // int totalpages = 0; //总页数 // int limit = 10; //每页显示记录条数 //计算记录总数的第二种办法:使用mysql的聚集函数count(*) String sql2 = "select count(*) from policy "; ResultSet res = statement.executeQuery(sql2); if (res.next()) { count = res.getInt(1);//结果为count(*)表,只有一列。这里通过列的下标索引(1)来获取值 } //由记录总数除以每页记录数得出总页数 totalpages = (int) Math.ceil(count / (limit * 1.0)); //获取跳页时传进来的当前页面参数 String strPage = request.getParameter("pages"); //判断当前页面参数的合法性并处理非法页号(为空则显示第一页,小于0则显示第一页,大于总页数则显示最后一页) if (strPage == null) { pages = 1; } else { try { pages = java.lang.Integer.parseInt(strPage); } catch (Exception e) { pages = 1; } if (pages < 1) { pages = 1; } if (pages > totalpages) { pages = totalpages; } } //由(pages-1)*limit算出当前页面第一条记录,由limit查询limit条记录。则得出当前页面的记录 res = statement.executeQuery("select * from policy order by id limit " + (pages - 1) * limit + "," + limit); while (res.next()) { %> <tr> <td id="a" align="center" title="<%=res.getObject(2)%>"><a style="color:blue" href='show.jsp?q=<%=res.getObject(1) %>' onclick="javascript:return del()"><%=res.getObject(2) %> </a> </td> <td align="center"><%=res.getObject(8) %> </td> <td align="center"><%=res.getObject(9) %> </td> <td align="center"><%=res.getObject(3) %> </td> </tr> <% } %> <%-- <form name="f1" method="POST" action="index.jsp" onSubmit="return checknum()">--%> <%-- <table border="0">--%> <%-- <tr>--%> <%-- <td>第<%=pages%>页 共<%=totalpages%>页 <a href="index.jsp?pages=1">首页</a></td>--%> <%-- <td><a href="index.jsp?pages=<%=(pages<1)?pages:(pages-1) %>"> 上一页</a></td>--%> <%-- <td><a href="index.jsp?pages=<%=(pages>=totalpages)?totalpages:(pages+1)%>"> 下一页</a></td>--%> <%-- <td><a href="index.jsp?pages=<%=totalpages%>">最后一页</a></td>--%> <%-- <td>共 <%=count%>条数据</a></td>--%> <%-- <td>转到第:<input type="text" name="page" size="8">页<input type="submit" value="前往" name="cndok">--%> <%-- </td>--%> <%-- </tr>--%> <%-- </table>--%> <%-- </form>--%> <% } %> <form name="f1" method="POST" action="index.jsp" onSubmit="return checknum()"> <table border="0"> <tr> <td>第<%=pages%>页 共<%=totalpages%>页 <a href="index.jsp?pages=1">首页</a></td> <td><a href="index.jsp?pages=<%=(pages<1)?pages:(pages-1) %>"> 上一页</a></td> <td><a href="index.jsp?pages=<%=(pages>=totalpages)?totalpages:(pages+1)%>"> 下一页</a></td> <td><a href="index.jsp?pages=<%=totalpages%>">最后一页</a></td> <td>共 <%=count%>条数据</a></td> <td>转到第:<input type="text" name="page" size="8">页<input type="submit" value="前往" name="cndok"> </td> </tr> </table> </form> </table> <%--<script>--%> <%-- function changePage(pagename){--%> <%-- var i,page;--%> <%-- page=document.getElementsByClassName("page");--%> <%-- for(i=0;i<page.length;i++){--%> <%-- page[i].style.display="none";--%> <%-- }--%> <%-- document.getElementById(pagename).style.display="block";--%> <%-- }--%> <%--</script>--%> </body> </html>
<%--show.jsp--%> <%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> </head> <body> <jsp:useBean id="util" class="bean.policy" scope="page" /> <% String q=(String)request.getParameter("q"); session.setAttribute("q",q); %> <table border="1"style="text-align:center;"style="width:100%;table-layout:fixed;"> <tr> <td align="center" width="8%"></td> </tr> <% Class.forName("com.mysql.jdbc.Driver"); // 2.使用我自己的数据库 test 获取链接 String url = "jdbc:mysql://localhost:3306/test"; String username = "root"; String password = "123456"; Connection connection = DriverManager.getConnection(url, username, password); //获取执行sql的对象statement Statement statement = connection.createStatement(); ResultSet rs=null; try { String sql = "select * from policy where id = '"+q+"'"; rs=statement.executeQuery(sql); while(rs.next()){ %> <tr> <td align="center"><%=rs.getObject(19)%></td> </tr> <% } } catch (SQLException e) { e.printStackTrace(); }finally{ util.close(rs); util.close(connection); } %> </table> </form> </body> </html>
//search.java package com.example.demo1; import java.io.*; import java.math.BigInteger; import java.sql.*; import java.util.ArrayList; import java.util.Date; import java.util.List; import jakarta.servlet.ServletException; import jakarta.servlet.http.*; import jakarta.servlet.annotation.*; @WebServlet(name = "search", value = "/search") public class search extends HttpServlet { private String message; public void init() { message = "Hello World!"; } public List<shuju> l=new ArrayList<>(); public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { String c2=request.getParameter("c2"); String c6=request.getParameter("c6"); String c8=request.getParameter("c8"); String c19=request.getParameter("c19"); try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } // 2.使用我自己的数据库 test 获取链接 String url = "jdbc:mysql://localhost:3306/test"; String username = "root"; String password = "123456"; Connection connection = null; try { connection = DriverManager.getConnection(url, username, password); } catch (SQLException e) { throw new RuntimeException(e); } //获取执行sql的对象statement Statement statement = null; try { statement = connection.createStatement(); } catch (SQLException e) { throw new RuntimeException(e); } ResultSet rs = null; int pages=0; //待显示页面 int count=0; //总条数 int totalpages=0; //总页数 int limit=10; //每页显示记录条数 //计算记录总数的第二种办法:使用mysql的聚集函数count(*) String a=""; String t="select count(*) from policy where"; int flag=0; if(!c2.equals(a)){ t+=(" name like '%"+c2+"%' "); flag=1; } if(!c6.equals(a)){ if(flag==1) t+=(" and"); t+=(" document like '%"+c6+"%'"); flag=1; } if(!c8.equals(a)){ if(flag==1) t+=(" and"); t+=(" organ like '%"+c8+"%' "); flag=1; } if(!c19.equals(a)){ if(flag==1) t+=(" and"); t+=(" text like '%"+c19+"%'"); flag=1; } System.out.println(t); String sql= " select count(*) from policy where name = '"+c2+"' or document = '"+c6+"' or organ = '"+c8+"' or text = '"+c19+"'"; try { rs=statement.executeQuery(t); } catch (SQLException e) { throw new RuntimeException(e); } try { if(rs.next()){ count = rs.getInt(1);//结果为count(*)表,只有一列。这里通过列的下标索引(1)来获取值 } } catch (SQLException e) { throw new RuntimeException(e); } //由记录总数除以每页记录数得出总页数 totalpages = (int)Math.ceil(count/(limit*1.0)); //获取跳页时传进来的当前页面参数 String strPage = request.getParameter("pages"); //判断当前页面参数的合法性并处理非法页号(为空则显示第一页,小于0则显示第一页,大于总页数则显示最后一页) if (strPage == null) { pages = 1; } else { try{ pages = java.lang.Integer.parseInt(strPage); }catch(Exception e){ pages = 1; } if (pages < 1){ pages = 1; } if (pages > totalpages){ pages = totalpages; } } a=""; t="select * from policy where"; flag=0; if(!c2.equals(a)){ t+=(" name like '%"+c2+"%' "); flag=1; } if(!c6.equals(a)){ if(flag==1) t+=(" and"); t+=(" document like '%"+c6+"%' "); flag=1; } if(!c8.equals(a)){ if(flag==1) t+=(" and"); t+=(" organ like '%"+c8+"%' "); flag=1; } if(!c19.equals(a)){ if(flag==1) t+=(" and"); t+=(" text like '%"+c19+"%'"); flag=1; } System.out.println(t); //String tsql= " select * from policy where name like '"+c2+"'or document like '"+c6+"' or organ like '"+c8+"' or text like '"+c19+"'"; //由(pages-1)*limit算出当前页面第一条记录,由limit查询limit条记录。则得出当前页面的记录 try { rs = statement.executeQuery(t); } catch (SQLException e) { throw new RuntimeException(e); } while(true){ try { if (!rs.next()) break; } catch (SQLException e) { throw new RuntimeException(e); } shuju s=null; try { s=new shuju((BigInteger) rs.getObject(1),(String) rs.getObject(2),(String) rs.getObject(3), (String) rs.getObject(6), (String) rs.getObject(8),(Date) rs.getObject(9), (String) rs.getObject(19)); } catch (SQLException e) { throw new RuntimeException(e); } l.add(s); } request.setAttribute("c2",c2); request.setAttribute("c6",c6); request.setAttribute("c8",c8); request.setAttribute("c19",c19); request.setAttribute("l2",l); System.out.println(l.size()); try { request.getRequestDispatcher("index.jsp").forward(request,response); } catch (ServletException e) { throw new RuntimeException(e); } } public void destroy() { } }
//shuju.java package com.example.demo1; import java.math.BigInteger; import java.util.Date; public class shuju { public String c2=null,c3=null,c6=null,c8=null,c19=null; public Date c9; public BigInteger c1; public shuju(BigInteger c1,String c2,String c3,String c6,String c8,Date c9,String c19) { this.c1=c1; this.c2 = c2; this.c3=c3; this.c6 = c6; this.c8 = c8; this.c9=c9; this.c19 = c19; } public String getC2() { return c2; } public String getC6() { return c6; } public String getC8() { return c8; } public String getC19() { return c19; } public void setC8(String c8) { this.c8 = c8; } public void setC6(String c6) { this.c6 = c6; } public void setC19(String c19) { this.c19 = c19; } public void setC2(String c2) { this.c2 = c2; } }
<%--search.jsp--%> <%-- Created by IntelliJ IDEA. User: adnim Date: 2022/10/21 Time: 0:27 To change this template use File | Settings | File Templates. --%> <%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>查询</title> <style> #a { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } </style> </head> <body style="text-align:center"> <% String c2=(String)request.getParameter("c2"); String c6 =(String)request.getParameter("c6"); String c8 =(String)request.getParameter("c8"); String c19 =(String)request.getParameter("c19"); System.out.println(c2+c6+c8); %> <table border="1"style="text-align:center;"> <tr> <td align="center" width=400px>政策名称</td> <td align="center" width=300px>发文机构</td> <td align="center" width=200px>颁布日期</td> <td align="center" width=300px>政策分类</td> </tr> <% Class.forName("com.mysql.jdbc.Driver"); // 2.使用我自己的数据库 test 获取链接 String url = "jdbc:mysql://localhost:3306/test"; String username = "root"; String password = "123456"; Connection connection = DriverManager.getConnection(url, username, password); //获取执行sql的对象statement Statement statement = connection.createStatement(); ResultSet rs = null; int pages=0; //待显示页面 int count=0; //总条数 int totalpages=0; //总页数 int limit=10; //每页显示记录条数 //计算记录总数的第二种办法:使用mysql的聚集函数count(*) String sql= " select count(*) from policy where name = '"+c2+"' or document = '"+c6+"' or organ = '"+c8+"' or text = '"+c19+"'"; rs=statement.executeQuery(sql); if(rs.next()){ count = rs.getInt(1);//结果为count(*)表,只有一列。这里通过列的下标索引(1)来获取值 } //由记录总数除以每页记录数得出总页数 totalpages = (int)Math.ceil(count/(limit*1.0)); //获取跳页时传进来的当前页面参数 String strPage = request.getParameter("pages"); //判断当前页面参数的合法性并处理非法页号(为空则显示第一页,小于0则显示第一页,大于总页数则显示最后一页) if (strPage == null) { pages = 1; } else { try{ pages = java.lang.Integer.parseInt(strPage); }catch(Exception e){ pages = 1; } if (pages < 1){ pages = 1; } if (pages > totalpages){ pages = totalpages; } } String a=""; String t="select * from policy where"; int flag=0; if(!c2.equals(a)){ t+=(" name like '%"+c2+"%' "); flag=1; } if(!c6.equals(a)){ if(flag==1) t+=(" and"); t+=(" organ like '%"+c6+"%' "); flag=1; } if(!c8.equals(a)){ if(flag==1) t+=(" and"); t+=(" document like '%"+c8+"%'"); flag=1; } if(!c19.equals(a)){ if(flag==1) t+=(" and"); t+=(" text like '%"+c19+"%'"); flag=1; } System.out.println(t); //String tsql= " select * from policy where name like '"+c2+"'or document like '"+c6+"' or organ like '"+c8+"' or text like '"+c19+"'"; //由(pages-1)*limit算出当前页面第一条记录,由limit查询limit条记录。则得出当前页面的记录 rs = statement.executeQuery(t); while (rs.next()){ %> <tr> <td id= "a" align="center" title="<%=rs.getObject(2)%>"> <a style="color:blue" href='show.jsp?q=<%=rs.getObject(1) %>' onclick="javascript:return del()"> <%=rs.getObject(2) %></a> </td> <td align="center"><%=rs.getObject(8) %> </td> <td align="center"><%=rs.getObject(9) %> </td> <td align="center"><%=rs.getObject(3) %> </td> </tr> <% } %> <form name="f1" method="POST" action="search.jsp" onSubmit="return checknum()"> <table border="0" > <tr> <td>第<%=pages%>页 共<%=totalpages%>页 <a href="search.jsp?pages=1">首页</a></td> <td><a href="search.jsp?pages=<%=(pages<1)?pages:(pages-1) %>"> 上一页</a></td> <td><a href="search.jsp?pages=<%=(pages>=totalpages)?totalpages:(pages+1)%>"> 下一页</a></td> <td><a href="search.jsp?pages=<%=totalpages%>">最后一页</a></td> <td>共 <%=count%>条数据</a></td> <td>转到第:<input type="text" name="page" size="8">页<input type="submit" value="前往" name="cndok"></td> </tr> </table> </form> </table>
<%@ page import="java.sql.*" %><%-- Created by IntelliJ IDEA. User: JC Date: 2023/4/10 Time: 15:38 To change this template use File | Settings | File Templates. --%> <%-- Created by IntelliJ IDEA. User: JC Date: 2023/4/2 Time: 0:10 To change this template use File | Settings | File Templates. --%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>查询</title> <style> #a { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } </style> </head> <body> <form action="search.jsp" method="get"> <p color: black; font-family: 宋体; font-size: 10px ></p> 政策名称 <input type="text" placeholder="请输入政策名称"name="c2" > 发文字号 <input type="text" placeholder="请输入发文字号" name="c6" > 发文机构<input type="text" name="c8" /> <input type="submit" value="查询" /> </p> </form> <jsp:useBean id="util" class="bean.policy" scope="page" /> <table border="1" style="text-align:center;"> <tr> <td align="center" width=400px>政策名称</td> <td align="center" width=300px>发文机构</td> <td align="center" width=200px>颁布日期</td> <td align="center" width=300px>政策分类</td> </tr> <% Class.forName("com.mysql.jdbc.Driver"); // 2.使用我自己的数据库 test 获取链接 String url = "jdbc:mysql://localhost:3306/test"; String username = "root"; String password = "123456"; Connection connection = DriverManager.getConnection(url, username, password); //获取执行sql的对象statement Statement statement = connection.createStatement(); int pages=0; //待显示页面 int count=0; //总条数 int totalpages=0; //总页数 int limit=10; //每页显示记录条数 //计算记录总数的第二种办法:使用mysql的聚集函数count(*) String sql2 = "select count(*) from policy "; ResultSet rs = statement.executeQuery(sql2); if(rs.next()){ count = rs.getInt(1);//结果为count(*)表,只有一列。这里通过列的下标索引(1)来获取值 } //由记录总数除以每页记录数得出总页数 totalpages = (int)Math.ceil(count/(limit*1.0)); //获取跳页时传进来的当前页面参数 String strPage = request.getParameter("pages"); //判断当前页面参数的合法性并处理非法页号(为空则显示第一页,小于0则显示第一页,大于总页数则显示最后一页) if (strPage == null) { pages = 1; } else { try{ pages = java.lang.Integer.parseInt(strPage); }catch(Exception e){ pages = 1; } if (pages < 1){ pages = 1; } if (pages > totalpages){ pages = totalpages; } } //由(pages-1)*limit算出当前页面第一条记录,由limit查询limit条记录。则得出当前页面的记录 rs = statement.executeQuery("select * from policy order by viadata Desc , id limit " + (pages - 1) * limit + "," + limit ) ; while (rs.next()){ %> <tr> <td id= "a" align="center" title="<%=rs.getObject(2)%>"> <a style="color:blue" href='show.jsp?q=<%=rs.getObject(1) %>' onclick="javascript:return del()"> <%=rs.getObject(2) %></a> </td> <td align="center"><%=rs.getObject(8) %> </td> <td align="center"><%=rs.getObject(9) %> </td> <td align="center"><%=rs.getObject(3) %> </td> </tr> <% } %> <form name="f1" method="POST" action="index_v148b2.jsp" onSubmit="return checknum()"> <table border="0" > <tr> <td>第<%=pages%>页 共<%=totalpages%>页 <a href="index_v148b2.jsp?pages=1">首页</a></td> <td><a href="index_v148b2.jsp?pages=<%=(pages<1)?pages:(pages-1) %>"> 上一页</a></td> <td><a href="index_v148b2.jsp?pages=<%=(pages>=totalpages)?totalpages:(pages+1)%>"> 下一页</a></td> <td><a href="index_v148b2.jsp?pages=<%=totalpages%>">最后一页</a></td> <td>共 <%=count%>条数据</a></td> <td>转到第:<input type="text" name="page" size="8">页<input type="submit" value="前往" name="cndok"></td> </tr> </table> </form> </table>标签:2024.05,String,23,totalpages,flag,limit,--%,pages From: https://www.cnblogs.com/dmx-03/p/18243884