?? pagetag.java
字號:
package com.emis.dbservice.hibernate;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
public final class pageTag extends TagSupport {
private String actiondo;
private int currentPage;
private int maxPage;
public String getAction() {
return actiondo;
}
public void setAction(String action) {
this.actiondo = action;
}
@Override
public int doEndTag() throws JspException {
JspWriter out = this.pageContext.getOut();
try {
out.println("<font size='2'>");
if (this.currentPage == 1) {
out.println("首頁 上一頁");
} else {
out.println("<a href='" + actiondo + ".do?direct=first'>"
+ "首頁</a>");
out.println(" ");
out.println("<a href='" + actiondo + ".do?direct=previous'>" + "上一頁</a>");
}
if (this.currentPage > maxPage) {
this.currentPage = maxPage;
}
if (this.currentPage == maxPage) {
out.println("下一頁 尾頁");
} else {
out.println("<a href='" + actiondo + ".do?direct=next'>" + "下一頁</a>");
out.println(" ");
out.println("<a href='" + actiondo + ".do?direct=last'>" + "尾頁</a>");
}
out.println("</font>");
} catch (Exception e) {
e.printStackTrace();
}
return this.EVAL_PAGE;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getMaxPage() {
return maxPage;
}
public void setMaxPage(int maxPage) {
this.maxPage = maxPage;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -