⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lastpage.java

📁 这个是一个网站的简单源码
💻 JAVA
字号:
package com.jewel.tag.pagination;

import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.TagSupport;
/**
 * <p>Title: www.entel.com.cn</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: entel</p>
 * @author chendesheng
 * @version 1.0
 */

public class LastPage extends TagSupport implements PagerInterface {
  protected String offset = "0";
  protected String length = "10";

  public int doStartTag() throws JspException {
    Common comm = new Common((HttpServletRequest) pageContext.getRequest());
    this.setLength(""+comm.pageLength);
    //计算总页数
    int PageCount = 0;
    if(comm.AllElementCount % comm.pageLength==0)
      PageCount = comm.AllElementCount / comm.pageLength -1;
    else
      PageCount = comm.AllElementCount / comm.pageLength ;

    String urlOffSet = "" + PageCount*comm.pageLength;
    setOffset(urlOffSet);
    String out = comm.generateOffSet(getOffset(),comm.Last);
    write(out);
    return SKIP_BODY;
  }

  private void write(String param) throws JspException {
    try {
      pageContext.getOut().write(param);
    } catch (IOException oe) {
      throw new JspTagException("IOException while writing to the Client: " +
                                oe.getMessage());
    }
  }

  public String toString() {
    String result = "";
    return result;
  }
  public String getLength() {
    return length;
  }
  public void setLength(String length) {
    this.length = length;
  }
  public void setOffset(String offset) {
    this.offset = offset;
  }
  public String getOffset() {
    return offset;
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -