From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/tag/PageTag.java | 466 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 233 insertions(+), 233 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/tag/PageTag.java b/fanli/src/main/java/com/yeshi/fanli/tag/PageTag.java index 39e15e2..12af09b 100644 --- a/fanli/src/main/java/com/yeshi/fanli/tag/PageTag.java +++ b/fanli/src/main/java/com/yeshi/fanli/tag/PageTag.java @@ -1,233 +1,233 @@ -package com.yeshi.fanli.tag; - -import java.io.IOException; -import java.util.Iterator; -import java.util.Map; - -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.JspWriter; -import javax.servlet.jsp.tagext.TagSupport; - -public class PageTag extends TagSupport { - - /** - * - */ - private static final long serialVersionUID = 1L; - private String url; // 锟斤拷锟接碉拷址 - private int pageindex;// 锟斤拷前页 - private int pagesize; // 页锟斤拷小 - private int totalLines; // 锟杰硷拷录锟斤拷锟斤拷 - private Map<String, String> params;// 锟斤拷锟接诧拷锟斤拷 - private String preimage; - private String nextimage; - private String pagebg; - private String inputbg; - private String gobg; - - public int getPageindex() { - return pageindex; - } - - public void setPageindex(int pageindex) { - this.pageindex = pageindex; - } - - public String getPreimage() { - return preimage; - } - - public void setPreimage(String preimage) { - this.preimage = preimage; - } - - public String getNextimage() { - return nextimage; - } - - public void setNextimage(String nextimage) { - this.nextimage = nextimage; - } - - public String getPagebg() { - return pagebg; - } - - public void setPagebg(String pagebg) { - this.pagebg = pagebg; - } - - public String getInputbg() { - return inputbg; - } - - public void setInputbg(String inputbg) { - this.inputbg = inputbg; - } - - public String getGobg() { - return gobg; - } - - public void setGobg(String gobg) { - this.gobg = gobg; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public int getPagesize() { - return pagesize; - } - - public void setPagesize(int pagesize) { - this.pagesize = pagesize; - } - - public int getTotalLines() { - return totalLines; - } - - public void setTotalLines(int totalLines) { - this.totalLines = totalLines; - } - - public Map<String, String> getParams() { - return params; - } - - public void setParams(Map<String, String> params) { - this.params = params; - } - - private int totalPages() { - return totalLines % pagesize == 0 ? totalLines / pagesize : totalLines - / pagesize + 1; - } - - // 锟斤拷取锟斤拷锟斤拷锟経RL - private String getAllUrl(int pageIndex) { - String baseUrl = url; - baseUrl += "?pageIndex=" + pageIndex; - if (params != null) { - Iterator<String> its = params.keySet().iterator(); - while (its.hasNext()) { - String key = its.next(); - String value = params.get(key); - baseUrl += "&" + key + "=" + value; - } - } - return baseUrl; - } - - @Override - public int doStartTag() throws JspException { - int totalPage = totalPages(); - String style = "background:url(" - + pagebg - + ");width:38px;height:38px;text-align:center;line-height:38px;float:left;margin-left:1px;border:0;"; - - String shenYuStyle = "float:left;margin-left:10px;height:38px;line-height:38px;"; - - String jumpText = "float:left;margin-left:107px;height:38px;line-height:38px;"; - - String inputStyle = "border:0;background:url(" - + pagebg - + ");width:36px;height:36px;text-align:center;line-height:38px;float:left;margin-left:10px;"; - String content = "<div style='" + style + "'>" - + "<a href=''><img src='" + preimage + "' /></a></div>" - + "<div ><a href=''><input type='button' value='1' style='" - + style + "' /></a></div>" + "<div style='" + style - + "'><a href=''><img src='" + nextimage + "'/></a></div>" - + "<div style='" + jumpText + "'>锟斤拷前页:" + pageindex + "/" - + totalPage + " 锟斤拷转锟斤拷锟斤拷</div>" - + "<div ><input type='text' style='" + inputStyle - + "' /></div>" + "<a href=''><div style='" + style - + "'>Go</div></a>"; - if (pageindex < 1) - pageindex = 1; - if (pageindex > totalPage) - pageindex = totalPage; - String c = "<div style='" + style + "'>" + "<a href='" - + getAllUrl((pageindex > 1 ? pageindex - 1 : 1)) - + "'><img src='" + preimage + "' /></a></div>"; - if (totalPage < 6) { - - for (int i = 0; i < totalPage; i++) { - c += "<div><a href='" + getAllUrl((i + 1)) - + "'><input type='button' value='" + (i + 1) - + "' style='" + style + "' /></a></div>"; - } - - } else { - if (Math.abs(pageindex) < 3 || Math.abs(pageindex - totalPage) < 3) { - if (Math.abs(pageindex) <= 3) { - for (int i = 0; i < 5; i++) { - c += "<div><a href='" + getAllUrl((i + 1)) - + "'><input type='button' value='" + (i + 1) - + "' style='" + style + "' /></a></div>"; - } - } else { - - for (int i = 0; i < 5; i++) { - c += "<div><a href='" + getAllUrl(totalPage - 4 + i) - + "'><input type='button' value='" - + (totalPage - 4 + i) + "' style='" + style - + "' /></a></div>"; - } - - } - - } else { - - for (int i = 0; i < 5; i++) { - c += "<div><a href='" + getAllUrl(i + pageindex - 2) - + "'><input type='button' value='" - + (i + pageindex - 2) + "' style='" + style - + "' /></a></div>"; - } - } - } - - c += "<div style='" - + style - + "'><a href='" - + getAllUrl(pageindex + 1 > totalPage ? totalPage - : pageindex + 1) + "'><img src='" + nextimage - + "'/></a></div>" + "<div style='" + jumpText + "'>锟斤拷前页:" - + pageindex + "/" + totalPage + " 锟斤拷转锟斤拷锟斤拷</div>" - + "<div ><input type='text' id='jumppage' style='" + inputStyle - + "' /></div>" - + "<a href='#' onclick='javascript:getPage()'><div style='" - + style + "'>Go</div>"; - - System.out.println(pageindex + "-" + totalLines + "-" + pagesize + "-" - + url + "-" + preimage + "-" + nextimage + "-" + pagebg + "-" - + inputbg + "-" + gobg + "-" - + pageContext.getRequest().getLocalAddr()); - - JspWriter out = this.pageContext.getOut(); - try { - out.print("<script type='text/javascript'>alert('123123'); function getPage(){alert('page');window.location=" - + url - + "?pageIndex=document.getElementById('jumppage').value; }</script>"); - out.print(c); - } catch (IOException e) { - e.printStackTrace(); - } - - return EVAL_BODY_INCLUDE; - } - - @Override - public int doEndTag() throws JspException { - // TODO Auto-generated method stub - return super.doEndTag(); - } - -} +package com.yeshi.fanli.tag; + +import java.io.IOException; +import java.util.Iterator; +import java.util.Map; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspWriter; +import javax.servlet.jsp.tagext.TagSupport; + +public class PageTag extends TagSupport { + + /** + * + */ + private static final long serialVersionUID = 1L; + private String url; // 锟斤拷锟接碉拷址 + private int pageindex;// 锟斤拷前页 + private int pagesize; // 页锟斤拷小 + private int totalLines; // 锟杰硷拷录锟斤拷锟斤拷 + private Map<String, String> params;// 锟斤拷锟接诧拷锟斤拷 + private String preimage; + private String nextimage; + private String pagebg; + private String inputbg; + private String gobg; + + public int getPageindex() { + return pageindex; + } + + public void setPageindex(int pageindex) { + this.pageindex = pageindex; + } + + public String getPreimage() { + return preimage; + } + + public void setPreimage(String preimage) { + this.preimage = preimage; + } + + public String getNextimage() { + return nextimage; + } + + public void setNextimage(String nextimage) { + this.nextimage = nextimage; + } + + public String getPagebg() { + return pagebg; + } + + public void setPagebg(String pagebg) { + this.pagebg = pagebg; + } + + public String getInputbg() { + return inputbg; + } + + public void setInputbg(String inputbg) { + this.inputbg = inputbg; + } + + public String getGobg() { + return gobg; + } + + public void setGobg(String gobg) { + this.gobg = gobg; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public int getPagesize() { + return pagesize; + } + + public void setPagesize(int pagesize) { + this.pagesize = pagesize; + } + + public int getTotalLines() { + return totalLines; + } + + public void setTotalLines(int totalLines) { + this.totalLines = totalLines; + } + + public Map<String, String> getParams() { + return params; + } + + public void setParams(Map<String, String> params) { + this.params = params; + } + + private int totalPages() { + return totalLines % pagesize == 0 ? totalLines / pagesize : totalLines + / pagesize + 1; + } + + // 锟斤拷取锟斤拷锟斤拷锟経RL + private String getAllUrl(int pageIndex) { + String baseUrl = url; + baseUrl += "?pageIndex=" + pageIndex; + if (params != null) { + Iterator<String> its = params.keySet().iterator(); + while (its.hasNext()) { + String key = its.next(); + String value = params.get(key); + baseUrl += "&" + key + "=" + value; + } + } + return baseUrl; + } + + @Override + public int doStartTag() throws JspException { + int totalPage = totalPages(); + String style = "background:url(" + + pagebg + + ");width:38px;height:38px;text-align:center;line-height:38px;float:left;margin-left:1px;border:0;"; + + String shenYuStyle = "float:left;margin-left:10px;height:38px;line-height:38px;"; + + String jumpText = "float:left;margin-left:107px;height:38px;line-height:38px;"; + + String inputStyle = "border:0;background:url(" + + pagebg + + ");width:36px;height:36px;text-align:center;line-height:38px;float:left;margin-left:10px;"; + String content = "<div style='" + style + "'>" + + "<a href=''><img src='" + preimage + "' /></a></div>" + + "<div ><a href=''><input type='button' value='1' style='" + + style + "' /></a></div>" + "<div style='" + style + + "'><a href=''><img src='" + nextimage + "'/></a></div>" + + "<div style='" + jumpText + "'>锟斤拷前页:" + pageindex + "/" + + totalPage + " 锟斤拷转锟斤拷锟斤拷</div>" + + "<div ><input type='text' style='" + inputStyle + + "' /></div>" + "<a href=''><div style='" + style + + "'>Go</div></a>"; + if (pageindex < 1) + pageindex = 1; + if (pageindex > totalPage) + pageindex = totalPage; + String c = "<div style='" + style + "'>" + "<a href='" + + getAllUrl((pageindex > 1 ? pageindex - 1 : 1)) + + "'><img src='" + preimage + "' /></a></div>"; + if (totalPage < 6) { + + for (int i = 0; i < totalPage; i++) { + c += "<div><a href='" + getAllUrl((i + 1)) + + "'><input type='button' value='" + (i + 1) + + "' style='" + style + "' /></a></div>"; + } + + } else { + if (Math.abs(pageindex) < 3 || Math.abs(pageindex - totalPage) < 3) { + if (Math.abs(pageindex) <= 3) { + for (int i = 0; i < 5; i++) { + c += "<div><a href='" + getAllUrl((i + 1)) + + "'><input type='button' value='" + (i + 1) + + "' style='" + style + "' /></a></div>"; + } + } else { + + for (int i = 0; i < 5; i++) { + c += "<div><a href='" + getAllUrl(totalPage - 4 + i) + + "'><input type='button' value='" + + (totalPage - 4 + i) + "' style='" + style + + "' /></a></div>"; + } + + } + + } else { + + for (int i = 0; i < 5; i++) { + c += "<div><a href='" + getAllUrl(i + pageindex - 2) + + "'><input type='button' value='" + + (i + pageindex - 2) + "' style='" + style + + "' /></a></div>"; + } + } + } + + c += "<div style='" + + style + + "'><a href='" + + getAllUrl(pageindex + 1 > totalPage ? totalPage + : pageindex + 1) + "'><img src='" + nextimage + + "'/></a></div>" + "<div style='" + jumpText + "'>锟斤拷前页:" + + pageindex + "/" + totalPage + " 锟斤拷转锟斤拷锟斤拷</div>" + + "<div ><input type='text' id='jumppage' style='" + inputStyle + + "' /></div>" + + "<a href='#' onclick='javascript:getPage()'><div style='" + + style + "'>Go</div>"; + + System.out.println(pageindex + "-" + totalLines + "-" + pagesize + "-" + + url + "-" + preimage + "-" + nextimage + "-" + pagebg + "-" + + inputbg + "-" + gobg + "-" + + pageContext.getRequest().getLocalAddr()); + + JspWriter out = this.pageContext.getOut(); + try { + out.print("<script type='text/javascript'>alert('123123'); function getPage(){alert('page');window.location=" + + url + + "?pageIndex=document.getElementById('jumppage').value; }</script>"); + out.print(c); + } catch (IOException e) { + e.printStackTrace(); + } + + return EVAL_BODY_INCLUDE; + } + + @Override + public int doEndTag() throws JspException { + // TODO Auto-generated method stub + return super.doEndTag(); + } + +} -- Gitblit v1.8.0