?? jumppage.java
字號(hào):
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 JumpPage extends TagSupport implements PagerInterface {
private String offset = "0";
private String length = "10";
private String targetPage;
public int doStartTag() throws JspException {
Common comm = new Common((HttpServletRequest) pageContext.getRequest());
this.setLength(""+comm.pageLength);
String currentPageCount = pageContext.getRequest().getParameter("offset");
if(currentPageCount == null && comm.offset!=0 )
currentPageCount = ""+comm.offset;
// judge the current page
int group =0;
int crPage =0;
if(currentPageCount!=null && !currentPageCount.equalsIgnoreCase("")){
try{
crPage = Integer.parseInt(currentPageCount)/comm.pageLength;
if((crPage+1) % comm.jumpCount == 0 )
group = (crPage+1) / comm.jumpCount ;
else
group = crPage / comm.jumpCount;
if(Integer.parseInt(currentPageCount)>comm.AllElementCount){
group = 0; crPage = 0;
}
}catch(Exception e){
group = 0;
crPage = 0;
}
}
String out = comm.generateJump(group,crPage) ;
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 getTargetPage() {
return targetPage;
}
public void setTargetPage(String targetPage) {
this.targetPage = targetPage;
}
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;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -