每日总结 4.18
今日进行了数据库的显示,对于供货商页面的设计。
构思数据库如何才能更好的显示数据计算数据。
今天优先完成了科技政策的作业,和python的实验。
对供货商页面进行了简单绘制显示数据。
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ page import="java.sql.DriverManager" %> <%@ page import="java.sql.Connection" %> <%@ page import="queren.Login" %> <%@ page import="java.sql.ResultSet" %> <%@ page import="java.sql.Statement" %> <%@ page import="toolse.Tool" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page import="java.util.List" %> <!DOCTYPE html> <html lang="en" xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>河北省科技政策查询系统</title> <script th:src="@{/layuimini/js/lay-module/echarts/echarts.js}"></script> <script th:src="@{/layuimini/js/lay-module/echarts/wordcloud.js}"></script> <link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" /> <script src="https://www.layuicdn.com/layui/layui.js"></script> </head> <jsp:useBean id="util" class="queren.Daoq"/> <% request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); String name=request.getParameter("name"); %> <table class="layui-table"style="table-layout: fixed;word-wrap:break-word;"> <thead> <tr> <td style="width: 300px">手机号</td> <td style="width: 300px">p手机号</td> <td style="width: 650px">需求</td> <!-- <td style="width: 100px">操作</td> --> </tr> </thead> <tbody> <% try{ Connection conn = Tool.getConnection(); ResultSet rs = null; Statement statement = conn.createStatement(); String sql = "select * from car_send";//查询所有数据 rs = statement.executeQuery(sql); int intPageSize; //一页显示的记录数 int intRowCount; //记录的总数 int intPageCount; //总页数 int intPage; //待显示的页码 String strPage; int i; intPageSize = 15;//设置一页显示的记录数 strPage = request.getParameter("page");//取得待显示的页码 if (strPage == null) //判断strPage是否等于null,如果是,显示第一页数据 { intPage = 1; } else { intPage = java.lang.Integer.parseInt(strPage); //将字符串转换为整型 } if (intPage < 1) { intPage = 1; } rs.last(); //获取记录总数 intRowCount = rs.getRow(); intPageCount = (intRowCount + intPageSize - 1) / intPageSize;//计算总数 if (intPage > intPageCount) intPage = intPageCount;//调整待显示的页码 if (intPageCount > 0) { //将记录指针定位到待显示页的第一条记录上 rs.absolute((intPage - 1) * intPageSize + 1); } //下面用户显示数据 i = 0; while (i < intPageSize && !rs.isAfterLast()) { %> <tr> <td style="width: 300px"><%=rs.getString("user_phone")%></td> <td style="width: 150px"><%=rs.getString("pass_phone")%></td> <td style="width: 100px"><%=rs.getString("text") %></td> <!-- <td style="width: 100px"><a href="xiangqing.jsp?"><button type="submit" class="layui-btn"style="background-color: #1571b2" >查看详情</button></a> </td> --> </tr> <% rs.next(); i++; } rs.close();//关闭连接,释放资源 statement.close(); conn.close();%> </tbody> <tr> <td colspan="6">共<%=intRowCount%>条记录,共 <%=intPageCount%>页/ 当前为第<%=intPage%>页 <% for (int j = 1; j <= intPageCount; j++) { out.print(" <a href='table1.jsp?page=" + j + "'>" + j + "</a>");//跳转到第几页 } } catch (Exception e) { e.printStackTrace(); } %></td> </tr> </table>