记事本

order by seqno nulls last--空滞后--


//分页自定义标签
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import org.apache.struts.util.RequestUtils;

import com.vanceinfo.user.vo.Pagination;

public class PageTag extends TagSupport {
private String name;
private String property;
private String scope;
private String method;
private String zone;

public int doStartTag() throws JspException {

JspWriter out = pageContext.getOut();
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
Pagination page = (Pagination) RequestUtils.lookup(super.pageContext, name, property, scope);
int pageNo = page.getPageNo();
int totalPage = page.getTotalPage();
int count = page.getCount();
int prePage = page.getPrePage();
int nextPage = page.getNextPage();
int pageSize = page.getPageSize();
try {
out.println("共" + totalPage + "页 ");
out.println("当前为第" + pageNo + "页 ");
out.println("总记录为" + count + "条 ");
out.println("<a href='javascript:getPagination(" + prePage + "," + pageSize + ")'>上一页</a>&nbsp;");
out.println("<a href='javascript:getPagination(" + nextPage + "," + pageSize + ")'>下一页</a>&nbsp;");
out.println("<a href='javascript:getPagination(1," + pageSize + ")'>首页</a>&nbsp;");
out.println("<a href='javascript:getPagination(" + totalPage + "," + pageSize + ")'>尾页</a>&nbsp;");
out.println("<input type='hidden' name='ps' value='"+pageSize+"'/>\n<input type='hidden' name='pn' value='"+pageNo+"'/>");
out.println(
"\n<script>\n"
+ "function getPagination(pageNo,pageSize){\n"
+ "document.getElementById('pn').value=pageNo;\n"
+ "document.getElementById('ps').value=pageSize;\n"
+ "ajaxAnywhere.submitAJAX('"
+ method
+ "','"
+ zone
+ "');\n"
+ "}\n"
+ "</script>\n");
} catch (Exception e) {
e.printStackTrace();
throw new JspTagException ("IOException:" + e.toString());
}
return super.doStartTag();
}

public String getName() {
return name;
}

public String getProperty() {
return property;
}


public void setName(String string) {
name = string;
}


public void setProperty(String string) {
property = string;
}


public String getScope() {
return scope;
}


public void setScope(String string) {
scope = string;
}


public String getMethod() {
return method;
}


public String getZone() {
return zone;
}


public void setMethod(String string) {
method = string;
}


public void setZone(String string) {
zone = string;
}

}

<page:pageTag name="userForm" property="page" method="getUserInfo" zone="sResult,editZone"/>

你可能感兴趣的:(apache,jsp,servlet,struts)