首页 > 翻页错乱:代码如下

翻页错乱:代码如下

在刚开始翻页的时候,没有混乱。在不同条件下查询之后,在点击翻页就会出现,在之前的页码上继续加的现象,而不是显示第二页::
checksysdairy2.jsp

   <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
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>
    <base href="<%=basePath%>">
    <link href="media/css/bootstrap.min.css" rel="stylesheet"
    type="text/css" />
<link href="media/css/bootstrap-responsive.min.css" rel="stylesheet"
    type="text/css" />
<link href="media/css/font-awesome.min.css" rel="stylesheet"
    type="text/css" />
<link href="media/css/style-metro.css" rel="stylesheet" type="text/css" />
<link href="media/css/style.css" rel="stylesheet" type="text/css" />
<link href="media/css/style-responsive.css" rel="stylesheet"
    type="text/css" />
<link href="media/css/default.css" rel="stylesheet" type="text/css"
    id="style_color" />
<link href="media/css/uniform.default.css" rel="stylesheet"
    type="text/css" />
<!-- END GLOBAL MANDATORY STYLES -->
    <title>国家安全和案件情报态势感知平台</title>
    <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>
  tr:nth-child(odd){
   background: #d1d1d1;
  }
   tr:nth-child(even){
   background: #eeeeee;
  }
   tr:hover {
   background: #ffffff;
  }
 </style>
  </head>
  <body class="page-header-fixed" style="font-family: 微软雅黑;" onload='PageSystem2.action?ddpage=first&sip=${sessionScope.programlog.ip}&sprogram=${sessionScope.programlog.program}&mintime=${sessionScope.mmt.mintime}&maxtime=${sessionScope.mmt.maxtime}&stype=${sessionScope.mmt.stype}'>
   <!-- 包含网页的头 -->
    <jsp:include page="header.jsp" />
        <!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
        <div id="portlet-config" class="modal hide">
        </div>
        <div class="container-fluid" style="background-color: white;">
            <div class="row-fluid">
                <div class="span12">
                    
                    <div class="row-fluid" style="width: 80%;margin:  auto;">
                        <div class="span12" style="margin-top: 45px">
                            
                            <div class="portlet box grey tabbable">
                                <div class="portlet-title">
                                    <div class="caption">
                                        <i class="icon-reorder"></i> <span class="hidden-480">查看日志</span>
                                    </div>
                                </div>
                                <div class="portlet-body form">
                                    <div class="tabbable portlet-tabs">
                            <div style="height: 60px ">
                                 <!-- 查询action -->
                                <div style="height: 50px;line-height: 50px;">
                                     <form action="checksystemdairy2.action"  method="post">
                                           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <!-- 时间action -->
                                    <input type="hidden" name="IP" value="${sessionScope.plog.ip}"></input>
                                    <input type="hidden" name="PROGRAM" value="${sessionScope.plog.program}"></input>
                                   
                                    <input type="date" style="width:150px;height:25px; margin-left: 10px " name="mintime"  value="${sessionScope.mmt.mintime}"></input> ——
                                    <input type="date" style="width:150px ;height:25px;" name="maxtime" value="${sessionScope.mmt.maxtime}"></input> 
                                    <!-- 时间end  -->
                                    <select style="margin-left: 50px;height:30px;"  name="stype">
                                                <option value="${sessionScope.mmt.stype}">${sessionScope.mmt.stypename}</option>
                                                <option value="allstyle">全部类型</option>
                                                <option value="standard">标准</option>
                                                <option value="warning">警告</option>
                                                <option value="error">错误</option>
                                                <option value="unknown">未知</option>
                                    </select>
                                           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <input type="submit" value="&nbsp;&nbsp;查询" style="height: 30px;width: 80px;background-color: gray;color: white;border: gray 1px solid;margin-bottom: 10px"/>
                                   </form> 
                                        </div>
                                  <!--查询框end  -->
                                    </div>
                                     <table style="width: 100%" >
                                         <tr>
                                         <td align="center"><div style="background: #ffffff;font-size:20px; font-family:微软雅黑; height:40px;">类型</div></td>
                                         <td align="center"><div style="background: #ffffff;font-size:20px; font-family:微软雅黑; height:40px;">时间</div></td>
                                         <td align="center"><div style="background: #ffffff;font-size:20px; font-family:微软雅黑; height:40px;">内容</div></td>
                                        </tr>    
                                <c:forEach  items="${sessionScope.programlogls}" var="programlogls">        
                                         <tr>
                                         <td align="center" style="width:200px"><div style="font-size:17px; font-family:微软雅黑; height:40px;">${programlogls.type}</div></td>
                                         <td align="center" style="width:300px"><div style=" font-size:17px; font-family:微软雅黑; height:40px;">${programlogls.datetime}</div></td>
                                         <td align="center"><div style="font-size:17px; font-family:微软雅黑; height:40px; width:100%">${programlogls.content}</div></td>
                                        </tr>
                                </c:forEach>
                                    </table>  
              <div class="pagination pagination-right"><ul>    
      <li><a href="PageSystem2.action?ddpage=first&sip=${sessionScope.plog.ip}&sprogram=${sessionScope.plog.program}&mintime=${sessionScope.mmt.mintime}&maxtime=${sessionScope.mmt.maxtime}&stype=${sessionScope.mmt.stype}">首页</a></li>    
      <li><a href="PageSystem2.action?ddpage=previous&sip=${sessionScope.plog.ip}&sprogram=${sessionScope.plog.program}&mintime=${sessionScope.mmt.mintime}&maxtime=${sessionScope.mmt.maxtime}&stype=${sessionScope.mmt.stype}">上一页</a></li>
      <li><span style="margin-top: 0px" ></span></li>
      <li><a href="PageSystem2.action?ddpage=next&sip=${sessionScope.plog.ip}&sprogram=${sessionScope.plog.program}&mintime=${sessionScope.mmt.mintime}&maxtime=${sessionScope.mmt.maxtime}&stype=${sessionScope.mmt.stype}">下一页</a></li>    
      <li><a href="PageSystem2.action?ddpage=last&sip=${sessionScope.plog.ip}&sprogram=${sessionScope.plog.program}&mintime=${sessionScope.mmt.mintime}&maxtime=${sessionScope.mmt.maxtime}&stype=${sessionScope.mmt.stype}">尾页</a></li>
                                                       </ul>
            </div>
        </div>
                </div>
            </div>
        </div>
  </body>
</html>

checksystemdairy2.action

  package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import tools.PageSystemstatue;
import dao.SystemstatusDao;
import dao.impl.SystemstatusDaoImpl;
import entity.ProgramLog;
import entity.PublicPage;
import entity.conditionMMT;

@WebServlet(name = "checksystemdairyServlet2", urlPatterns = { "/checksystemdairy2.action" })
public class checksystemdairyServlet2 extends HttpServlet {
    // 新建业务层对象
    SystemstatusDaoImpl sys = new SystemstatusDaoImpl();

    // 新建通用分页类对象
    PageSystemstatue ps = new PageSystemstatue();

    /**
     * Constructor of the object.
     */
    public checksystemdairyServlet2() {
        super();
    }

    /**
     * Destruction of the servlet. <br>
     */
    public void destroy() {
        super.destroy(); // Just puts "destroy" string in log
        // Put your code here
    }

    /**
     * The doGet method of the servlet. <br>
     * 
     * This method is called when a form has its tag value method equals to get.
     * 
     * @param request
     *            the request send by the client to the server
     * @param response
     *            the response send by the server to the client
     * @throws ServletException
     *             if an error occurred
     * @throws IOException
     *             if an error occurred
     */
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html");
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        PrintWriter out = response.getWriter();

        // 存放选中的ip 和 program 保证每一个显示的jsp页面都能拿到 ip和program
        String IP = request.getParameter("IP");
        String PROGRAM = request.getParameter("PROGRAM");
        ProgramLog plog = new ProgramLog();
        
        plog.setIp(IP);
        plog.setProgram(PROGRAM);
        
        String mintime = request.getParameter("mintime");    
        String maxtime = request.getParameter("maxtime");        
        String stype = request.getParameter("stype");
   
        if (stype.equals("allstyle")) {
            String typeall = null;
            if (stype.equals("allstyle")) {
                typeall = "全部类型";
            }
            SystemstatusDao ss = new SystemstatusDaoImpl();
            ProgramLog programlog = null;
            List<ProgramLog> programlogl = new ArrayList<ProgramLog>();
            List<ProgramLog> programlogls = new ArrayList<ProgramLog>();
            PublicPage pp = new PublicPage();
            conditionMMT mmt = new conditionMMT();
            mmt.setMintime(mintime);
            mmt.setMaxtime(maxtime);
            mmt.setStype(stype);
            mmt.setStypename(typeall);

            // 接受翻页的指令
             String param = request.getParameter("ddpage");
               int count;
            try {
                // 查询符合条件的数据的总条数
                count = sys.allgetCount(IP, PROGRAM, mintime, maxtime);    
                // 计算最后一页的页码
                int lastPage = ps.getPagesCount(count, 30);
                // 计算应该显示的页码
                int pageNo = ps.getFenyePageNo(param, lastPage);
        
                pp.setLastPage(lastPage);
                pp.setPageNo(pageNo);
                
                programlogl = ss.allgetSystemCondition(IP, PROGRAM, mintime,
                        maxtime, pageNo, 30);
            
                for (int i = 0; i < programlogl.size(); i++) {
                    String type = null;
                    String type1 = null;
                    String datetime = null;
                    String content = null;
                    String datetime1 = null;
                    String ip = null;
                    String program = null;
                    programlog = new ProgramLog();
                    type1 = programlogl.get(i).getType();
                    if (type1.equals("standard")) {
                        type = "标准";
                    }
                    if (type1.equals("warning")) {
                        type = "警告";
                    }
                    if (type1.equals("error")) {
                        type = "错误";
                    }
                    if (type1.equals("unknown")) {
                        type = "未知";
                    }
                    datetime1 = programlogl.get(i).getDatetime();
                    datetime = datetime1.substring(0, 19);
                    content = programlogl.get(i).getContent();
                    ip = programlogl.get(i).getIp();
                    program = programlogl.get(i).getProgram();
                    // 存入programlog对象!
                    programlog.setType(type);
                    programlog.setDatetime(datetime);
                    programlog.setContent(content);
                    programlog.setIp(ip);
                    programlog.setProgram(program);
                    // 将对象存入programlogls集合!
                    programlogls.add(programlog);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            
//  看看每次传到 2.jsp页面的是什么?? 为什么在之前的基础上,加页数!            
            System.out.println("…………………………………………………………………………………………………………………………………………………………");
            System.out.println("最后页数:::All    "+pp.getLastPage());    
            System.out.println("当前页数::All     "+pp.getPageNo());
            System.out.println("小日期:::All     "+mmt.getMintime());    
            System.out.println("大日期:::All     "+mmt.getMaxtime());
            System.out.println("类型::All       "+mmt.getStype());
            System.out.println("ip:::All       "+plog.getIp());
            System.out.println("program::All   "+plog.getProgram());
            
            request.getSession().setAttribute("pp", pp);
            request.getSession().setAttribute("mmt", mmt);
            request.getSession().setAttribute("programlogls", programlogls);
            request.getSession().setAttribute("programlog", programlog);
            request.getSession().setAttribute("plog", plog);
            request.getRequestDispatcher("checksysdairy2.jsp").forward(request,response);
            out.flush();
            out.close();
        } else {
            SystemstatusDao ss = new SystemstatusDaoImpl();
            ProgramLog programlog = null;
            List<ProgramLog> programlogl = new ArrayList<ProgramLog>();
            List<ProgramLog> programlogls = new ArrayList<ProgramLog>();
        PublicPage pp = new PublicPage();
            conditionMMT mmt = new conditionMMT();
            mmt.setMintime(mintime);
            mmt.setMaxtime(maxtime);
            mmt.setStype(stype);
            // 接受翻页的指令
            String param = request.getParameter("ddpage");
            int count;
            try {
                // 查询符合条件的数据的总条数
                count = sys.getCount2(IP, PROGRAM, mintime, maxtime, stype);    
                if (count == 0) {
                    String style = null;
                    if (stype.equals("standard")) {
                        style = "标准";
                    }
                    if (stype.equals("warning")) {
                        style = "警告";
                    }
                    if (stype.equals("error")) {
                        style = "错误";
                    }
                    if (stype.equals("unknown")) {
                        style = "未知";
                    }
                    mmt.setStypename(style);
                    //计算最后一页的页码
                     int lastPage=ps.getPagesCount(count,30);     
                        //计算应该显示的页码
                     int pageNo1=ps.getFenyePageNoo(param,lastPage);
                     int pageNo=pageNo1+1;
            
                     pp.setLastPage(lastPage);
                     pp.setPageNo(pageNo1);
                     programlogl = ss.getSystemCondition(IP, PROGRAM, mintime,
                            maxtime, stype, pageNo, 30);
                    
                } else {
                    // 计算最后一页的页码
                    int lastPage = ps.getPagesCount(count, 30);        
                    // 计算应该显示的页码
                    int pageNo = ps.getFenyePageNo(param, lastPage);
                    
                    pp.setLastPage(lastPage);
                    pp.setPageNo(pageNo);
                    
                    programlogl = ss.getSystemCondition(IP, PROGRAM, mintime,
                            maxtime, stype, pageNo, 30);
                    for (int i = 0; i < programlogl.size(); i++) {
                        String type = null;
                        String type1 = null;
                        String datetime = null;
                        String content = null;
                        String datetime1 = null;
                        String ip = null;
                        String program = null;
                        programlog = new ProgramLog();
                        type1 = programlogl.get(i).getType();
                        if (type1.equals("standard")) {
                            type = "标准";
                        }
                        if (type1.equals("warning")) {
                            type = "警告";
                        }
                        if (type1.equals("error")) {
                            type = "错误";
                        }
                        if (type1.equals("unknown")) {
                            type = "未知";
                        }
                        mmt.setStypename(type);
                        datetime1 = programlogl.get(i).getDatetime();
                        datetime = datetime1.substring(0, 19);
                        content = programlogl.get(i).getContent();
                        ip = programlogl.get(i).getIp();
                        program = programlogl.get(i).getProgram();
                        // 存入programlog对象!
                        programlog.setType(type);
                        programlog.setDatetime(datetime);
                        programlog.setContent(content);
                        programlog.setIp(ip);
                        programlog.setProgram(program);
                        // 将对象存入programlogls集合!
                        programlogls.add(programlog);
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            request.getSession().setAttribute("pp", pp);
            request.getSession().setAttribute("mmt", mmt);
            request.getSession().setAttribute("programlogls", programlogls);
            request.getSession().setAttribute("programlog", programlog);
            request.getSession().setAttribute("plog", plog);
            request.getRequestDispatcher("checksysdairy2.jsp").forward(request,response);
            out.flush();
            out.close();

        }
    }

    /**
     * The doPost method of the servlet. <br>
     * 
     * This method is called when a form has its tag value method equals to
     * post.
     * 
     * @param request
     *            the request send by the client to the server
     * @param response
     *            the response send by the server to the client
     * @throws ServletException
     *             if an error occurred
     * @throws IOException
     *             if an error occurred
     */
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.doGet(request, response);
    }

    /**
     * Initialization of the servlet. <br>
     * 
     * @throws ServletException
     *             if an error occurs
     */
    public void init() throws ServletException {
        // Put your code here
    }
}

PageSystem2.action

package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import tools.PageSystemstatue;
import dao.SystemstatusDao;
import dao.impl.SystemstatusDaoImpl;
import entity.ProgramLog;
import entity.PublicPage;
import entity.conditionMMT;

@WebServlet(name = "PageSystemServlet2", urlPatterns = { "/PageSystem2.action" })
public class PageSystemServlet2 extends HttpServlet {      
    //新建业务层对象
    SystemstatusDaoImpl sys=new SystemstatusDaoImpl();
    
    //新建通用分页类对象
    PageSystemstatue ps=new PageSystemstatue();  
    
    /**
     * Constructor of the object.
     */
    public PageSystemServlet2() {
        super();
    }
    /**
     * Destruction of the servlet. <br>
     */
    public void destroy() {
        super.destroy(); // Just puts "destroy" string in log
        // Put your code here
    }
    /**
     * The doGet method of the servlet. <br>
     *
     * This method is called when a form has its tag value method equals to get.
     * 
     * @param request the request send by the client to the server
     * @param response the response send by the server to the client
     * @throws ServletException if an error occurred
     * @throws IOException if an error occurred
     */
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        
        String sip = request.getParameter("sip");    
        String sprogram = request.getParameter("sprogram");
        String mintime=request.getParameter("mintime");
        String maxtime=request.getParameter("maxtime");
        String stype=request.getParameter("stype");
        
        if(stype.equals("allstyle")){
              String typeall = null;
               if (stype.equals("allstyle")) {
                typeall = "全部类型";
            }
                SystemstatusDao ss=new  SystemstatusDaoImpl();
                  ProgramLog programlog= null;
                  List<ProgramLog> programlogl=new ArrayList<ProgramLog>();
                  List<ProgramLog> programlogls=new ArrayList<ProgramLog>();
                  PublicPage pp = new PublicPage(); 
                  conditionMMT mmt = new conditionMMT();
                  mmt.setMintime(mintime);
                  mmt.setMaxtime(maxtime);
                  mmt.setStype(stype);
                  mmt.setStypename(typeall);
                      //接受翻页的指令
                       String param=request.getParameter("ddpage");     
                      int count;
                  try {
                    //查询符合条件的数据的总条数
                      count = sys.allgetCount(sip,sprogram,mintime,maxtime);
             
                        //计算最后一页的页码
                     int lastPage=ps.getPagesCount(count,30);
               
                        //计算应该显示的页码
                     int pageNo=ps.getFenyePageNo(param,lastPage);
                 
                     pp.setLastPage(lastPage);
                     pp.setPageNo(pageNo);
                programlogl=ss.allgetSystemCondition(sip,sprogram,mintime,maxtime,pageNo,30);
                    for(int i=0;i<programlogl.size();i++){
                          String type=null;
                            String type1=null;
                          String datetime=null;
                          String content=null;
                          String datetime1=null;
                          String ip=null;
                          String program=null;
                        programlog = new ProgramLog();
                        type1 = programlogl.get(i).getType();
                    if(type1.equals("standard")){
                        type="标准";
                    }    
                    if(type1.equals("warning")){
                        type="警告";
                    }
                    if(type1.equals("error")){
                        type="错误";
                    }    
                    if(type1.equals("unknown")){
                        type="未知";
                    }
                        datetime1 =programlogl.get(i).getDatetime();
                        datetime = datetime1.substring(0, 19);    
                          content = programlogl.get(i).getContent();
                          ip = programlogl.get(i).getIp();
                          program = programlogl.get(i).getProgram();
                             //存入programlog对象!
                        programlog.setType(type);
                        programlog.setDatetime(datetime);
                        programlog.setContent(content);
                        programlog.setIp(ip);
                        programlog.setProgram(program);
                          //将对象存入programlogls集合!
                        programlogls.add(programlog);
                    }
                    
                } catch (Exception e) {
                    e.printStackTrace();
                }
                  request.getSession().setAttribute("pp", pp);
                  request.getSession().setAttribute("mmt", mmt);
                  request.getSession().setAttribute("programlogls", programlogls);
                  request.getSession().setAttribute("programlog", programlog);
                request.getRequestDispatcher("checksysdairy2.jsp").forward(request, response); 
                out.flush();
                out.close();   
               
        }else{
          String nametype=null;
        if(stype.equals("standard")){
            nametype="标准";
        }    
        if(stype.equals("warning")){
            nametype="警告";
        }
        if(stype.equals("error")){
            nametype="错误";
        }    
        if(stype.equals("unknown")){
            nametype="未知";
        }
        SystemstatusDao ss=new  SystemstatusDaoImpl();
          ProgramLog programlog= null;
          conditionMMT mmt = new conditionMMT();
          mmt.setMintime(mintime);
        mmt.setMaxtime(maxtime);
        mmt.setStype(stype);
        mmt.setStypename(nametype); 
          List<ProgramLog> programlogl=new ArrayList<ProgramLog>();
          List<ProgramLog> programlogls=new ArrayList<ProgramLog>();
          PublicPage pp = new PublicPage();  
              //接受翻页的指令0
               String param=request.getParameter("ddpage");
              int count;
        try {
             //查询符合条件的数据的总条数
              count = sys.getCount2(sip,sprogram,mintime,maxtime,stype); 
          if(count==0){
                //计算最后一页的页码
             int lastPage=ps.getPagesCount(count,30);    
                //计算应该显示的页码
             int pageNo1=ps.getFenyePageNoo(param,lastPage);
             int pageNo=pageNo1+1; 
    
             pp.setLastPage(lastPage);
             pp.setPageNo(pageNo1);
             
        programlogl=ss.getSystemCondition(sip,sprogram,mintime,maxtime,stype,pageNo,30);
          }else{
                //计算最后一页的页码
             int lastPage=ps.getPagesCount(count,30);        
                //计算应该显示的页码
             int pageNo=ps.getFenyePageNo(param,lastPage);

             
             pp.setLastPage(lastPage);
             pp.setPageNo(pageNo);
             
        programlogl=ss.getSystemCondition(sip,sprogram,mintime,maxtime,stype,pageNo,30);
          }
            for(int i=0;i<programlogl.size();i++){
                  String type=null;
                    String type1=null;
                  String datetime=null;
                  String content=null;
                  String datetime1=null;
                  String ip=null;
                  String program=null;
                programlog = new ProgramLog();
                type1 = programlogl.get(i).getType();
            if(type1.equals("standard")){
                type="标准";
            }    
            if(type1.equals("warning")){
                type="警告";
        }
            if(type1.equals("error")){
                type="错误";
            }    
            if(type1.equals("unknown")){
                type="未知";
            }
                 datetime1 =programlogl.get(i).getDatetime();
                 datetime = datetime1.substring(0, 19);    
                   content = programlogl.get(i).getContent();
                   ip = programlogl.get(i).getIp();
                   program = programlogl.get(i).getProgram();
                     //存入programlog对象!
                programlog.setType(type);
                programlog.setDatetime(datetime);
                programlog.setContent(content);
                programlog.setIp(ip);
                programlog.setProgram(program);
                
                  //将对象存入programlogls集合!
                programlogls.add(programlog);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
         request.getSession().setAttribute("mmt", mmt);
          request.getSession().setAttribute("pp", pp);
          request.getSession().setAttribute("programlogls", programlogls);
          request.getSession().setAttribute("programlog", programlog);
        request.getRequestDispatcher("checksysdairy2.jsp").forward(request, response); 
        out.flush();
        out.close();    
  }
}
    /**
     * The doPost method of the servlet. <br>
     *
     * This method is called when a form has its tag value method equals to post.
     * 
     * @param request the request send by the client to the server
     * @param response the response send by the server to the client
     * @throws ServletException if an error occurred
     * @throws IOException if an error occurred
     */
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
                        this.doGet(request, response);
    }
    /**
     * Initialization of the servlet. <br>
     *
     * @throws ServletException if an error occurs
     */
    public void init() throws ServletException {
        // Put your code here
    }
}

翻页的方法::

package tools;

public class PageSystemstatue {
    private int totalPages;
    public int getPagesCount(int count,int size) {
        // TODO Auto-generated method stub
        int totalCount=count;
        totalPages = totalCount % size == 0 ? totalCount / size : totalCount
                / size + 1;
        return totalPages;
    }
    private int currentPageNo;
    public int getFenyePageNo(String param,int lastPage) {
        if ("first".equals(param) || null == param) {
            currentPageNo = 1;
        } else if ("next".equals(param)) {
            if (currentPageNo < lastPage) {
                currentPageNo++;    
            }
        } else if ("previous".equals(param)) {
            if (currentPageNo > 1) {
                currentPageNo--;
            }
        } else if ("last".equals(param)) {
            currentPageNo = lastPage;
        }
        return currentPageNo;
    }
    
    private int currentPageNoo;
    public int getFenyePageNoo(String param, int lastPage) {
        if ("first".equals(param) || null == param) {
            currentPageNoo = 0;
        } else if ("next".equals(param)) {
            if (currentPageNoo < lastPage) {
                currentPageNoo = 0;
            }
        } else if ("previous".equals(param)) {
            if (currentPageNoo > 1) {
                currentPageNoo = 0;
            }
        } else if ("last".equals(param)) {
            currentPageNoo  = 0;
        }
        return currentPageNoo;
    }
}

太长...这平台也不是这么用的吧。
自己的代码只有自己懂~慢慢debug吧


太长,而且你格式都还没排好。。。。。。。。。


太长看的眼花,把关键逻辑代码贴出来就好了

【热门文章】
【热门文章】