4月14日笔记
table.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ page language="java" import="Bean.*" %> <%@ page language="java" import="Dao.*" %> <%@ page language="java" import="java.io.*" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <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> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <style type="text/css" > body{ text-align: center; } table{ text-align:center; border-collapse:collapse; } .font{ font-size: 30px; } </style> </head> <body class="font"> <div style="text-align:center;"> <img src="image/LOGO.png" width="40" height="40" style="margin-right: 10px;"> <span style="font-size: 35px; color:#1571b2;">科技政策查询系统</span> </div> <% request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); String name=request.getParameter("name"); String document=request.getParameter("document"); String organ=request.getParameter("organ"); dao type=new dao();%> <% if (name == null&&document==null&&organ==null){ List<bean> list = type.searchAll(); pageContext.setAttribute("list", list); int count=0; //总行数 int page_count=1; //开始条数 int page_total=1; //,总页码 int page_current= 1; //首页 int page_size=20;//一页的行数 %> <% String page_cu = request.getParameter("page_current"); if(page_cu==null){ page_cu="1"; } page_current = Integer.parseInt(page_cu); if(page_current<0){ page_current = 1; } page_count=page_count+ page_current*page_size; %> <br> <table class="layui-table"style="table-layout: fixed;word-wrap:break-word;"> <tr> <td style="width: 300px">政策名称</td> <td style="width: 150px">发文机构</td> <td style="width: 70px">颁布日期</td> <td style="width: 80px">政策分类</td> </tr> <c:forEach items="${list}" var="typebean" step="1" varStatus="i" begin="<%=page_count%>" end="<%=page_size+page_count-1%>"> <tr> <td style="width: 300px"><a href="servlet?method=xiangqing&id=${ typebean.getId()}">${typebean.getName()}</a> </td> <% count++; %> <td style="width: 150px">${typebean.getOrgan()}</td> <td style="width: 70px">${typebean.getPubdata() }</td> <td style="width: 80px">${ typebean.getType()}</td> </tr> </c:forEach> <tr> <td colspan="2" align="right"> 本页总共<%=count%>条 总共<%=list.size()%>条</td> <% page_total = ((list.size())%20==0)?((list.size())/20):((list.size())/20+1); %> <td colspan="2" align="center"> <a href = "table.jsp?page_current=1" >首页</a> <a href = "table.jsp?page_current=<%=page_current-1%>" >上一页</a> <a href = "table.jsp?page_current=<%=page_current+1%>" >下一页</a> <a href = "table.jsp?page_current=<%=page_total%>" >尾页</a> 第<%=page_current%> 页/共 <%=page_total%>页 </td> </tr> </table> <%}else{ List<bean> list = type.search(name,document,organ); pageContext.setAttribute("list", list); int count1=0; //总行数 int page_count1=1; //开始条数 int page_total1=1; //,总页码 int page_current1= 1; //首页 int page_size1=20;//一页的行数 %> <% String page_cu1 = request.getParameter("page_current"); if(page_cu1==null){ page_cu1="1"; } page_current1 = Integer.parseInt(page_cu1); if(page_current1<0){ page_current1 = 1; } page_count1=page_count1+ page_current1*page_size1; %> <br> <table class="layui-table"style="table-layout: fixed;word-wrap:break-word;"> <tr> <td style="width: 300px">政策名称</td> <td style="width: 150px">发文机构</td> <td style="width: 70px">颁布日期</td> <td style="width: 80px">政策分类</td> </tr> <%for (bean b : list) {%> <tr> <td style="width: 300px"><a href="servlet?method=xiangqing&id=<%=b.getId()%>"><%=b.getName()%></a> </td> <td style="width: 150px"><%=b.getOrgan()%></td> <td style="width: 70px"><%=b.getPubdata()%></td> <td style="width: 80px"><%=b.getType()%></td> </tr> <% count1++; %> <%} %> <tr> <td colspan="2" align="right"> 本页总共<%=count1%>条 总共<%=list.size()%>条</td> <% page_total1 = ((list.size())%20==0)?((list.size())/20):((list.size())/20+1); %> <td colspan="2" align="center"> <a href = "table.jsp?page_current=1" >首页</a> <a href = "table.jsp?page_current=<%=page_current1-1%>" >上一页</a> <a href = "table.jsp?page_current=<%=page_current1+1%>" >下一页</a> <a href = "table.jsp?page_current=<%=page_total1%>" >尾页</a> 第<%=page_current1%> 页/共 <%=page_total1%>页 </td> </tr> </table> <% }%> </body> </html>

浙公网安备 33010602011771号