【文件属性】:
文件名称:可伪可不伪的分页标签
文件大小:105KB
文件格式:RAR
更新时间:2016-02-08 16:07:58
分页
package org.wzj.common;
import java.io.IOException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;
public class FenyeTag extends BodyTagSupport {
private static final long serialVersionUID = 1L;
private String html;
private String exname;
private String target = ""; //链接所响应的框架窗口
private String cssClass; //样式名
private String action; //链接
private Integer pageCount; //总页数
private Integer current; //当前页码
private Integer showCount = 10; //在页面上显示多少个链接
private Integer spanWidth = 50;
public static final String TEXT = "background-color:blue;color:white;";
public int doEndTag(){
BodyContent body = this.getBodyContent();
JspWriter out = body.getEnclosingWriter();
html = "
";
int start = 1;
if ( pageCount > 0 ){
if ( current > pageCount ){
current = pageCount;
}
if ( current < 1 ){
current = 1;
}
if ( exname == null || exname.equals("")){
html += "
首页";
if ( current > showCount - showCount/3 ){
start = start + showCount/3*(current/(showCount/3)-2);
}
if ( current < showCount - showCount/3 ){
start = 1;
}
int rcount = 1;
////////////////////////////
for ( int i = 1; i <= pageCount; i ++ ){
if ( i >= start ){ //起始页码
if ( rcount <= showCount ){ //只显示showCount个链接
if ( exname == null || exname.equals("")){
html += "
" + i + " ";
}
if ( i < pageCount && rcount == showCount ){
html += "... ";
}
rcount ++;
}
}
////////////////////////////
if ( exname == null || exname.equals("")){
html += "
末页";
html += " 第
页 共页";
}
html += "";
try {
out.print(html);
out.flush();
body.clearBody();
} catch (IOException ex) {
ex.printStackTrace();
}
return this.EVAL_PAGE;
}
public String getExname() {
return exname;
}
public void setExname(String exname) {
this.exname = exname;
}
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
public String getCssClass() {
return cssClass;
}
public void setCssClass(String cssClass) {
this.cssClass = cssClass;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public Integer getPageCount() {
return pageCount;
}
public void setPageCount(Integer pageCount) {
this.pageCount = pageCount;
}
public Integer getCurrent() {
return current;
}
public void setCurrent(Integer current) {
this.current = current;
}
public Integer getShowCount() {
return showCount;
}
public void setShowCount(Integer showCount) {
this.showCount = showCount;
}
}
【文件预览】:
page.tld
分页标签用法示例.jpg
fenye.jar
fenye源码
----.mystrutsdata(240B)
----.settings()
--------org.eclipse.wst.jsdt.ui.superType.name(6B)
--------org.eclipse.wst.jsdt.ui.superType.container(49B)
--------.jsdtscope(500B)
----src()
--------fff()
--------struts.xml(370B)
--------org()
----.project(1KB)
----WebRoot()
--------META-INF()
--------WEB-INF()
--------index.jsp(662B)
--------style.css(615B)
----.mymetadata(288B)
----.classpath(463B)
----.myeclipse()
用法说明.txt