MyTag.java
上传用户:liangcc
上传日期:2019-05-24
资源大小:4412k
文件大小:1k
- package com.softeem.webmail.tags;
- import java.io.IOException;
- import javax.servlet.jsp.JspContext;
- import javax.servlet.jsp.JspException;
- import javax.servlet.jsp.JspWriter;
- import javax.servlet.jsp.tagext.SimpleTagSupport;
- public class MyTag extends SimpleTagSupport {
-
- private String action;
-
- private String current;
-
- private String end_page;
-
- public String getEnd_page() {
- return end_page;
- }
- public void setEnd_page(String end_page) {
- this.end_page = end_page;
- }
-
- public String getAction() {
- return action;
- }
- public void setAction(String action) {
- this.action = action;
- }
- public String getCurrent() {
- return current;
- }
- public void setCurrent(String current) {
- this.current = current;
- }
- @Override
- public void doTag() throws JspException, IOException {
- JspWriter w = getJspContext().getOut();
- w.println("<a href='"+action+"?page=1'>");
- w.println("首页");
- w.println("</a> ");
- if((Integer.parseInt(current)-1)>0){
- w.println("<a href='"+action+"?page="+(Integer.parseInt(current)-1)+"'>");
- w.println("上一页");
- w.println("</a> ");
- }
- else{
- w.println("上一页");
-
- }
- if((Integer.parseInt(current)+1)<=Integer.parseInt(end_page)){
- w.println("<a href='"+action+"?page="+(Integer.parseInt(current)+1)+"'>");
- w.println("下一页");
- w.println("</a> ");
- }
- else{
-
- w.println("下一页");
- }
- // super.doTag();
-
- }
-
-
- }