📄 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 + -