JSP:
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="ec" uri="http://www.ecside.org" %>
<%@ page isELIgnored="false"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>test ECtable 数据库分页</title>
<link rel="stylesheet" type="text/css" href="ecside/css/ecside_style.css" />
<script type="text/javascript" src="ecside/js/ecside.js" ></script>
<script type="text/javascript" src="ecside/js/ecside_msg_utf8_cn.js" ></script>
<script type="text/javascript" src="ecside/js/prototype_mini.js" ></script>
</head>
<body>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="100" style="text-align:center" valign="middle" bgcolor="#f7f7f7">
<ec:table items="list" var="list"
retrieveRowsCallback="limit"
sortRowsCallback="limit"
filterRowsCallback="limit"
action="XXX.action"
editable="false"
width="100%"
listWidth="100%"
classic="true"
doPreload="false"
useAjax="true"
resizeColWidth="false"
batchUpdate="true"
nearPageNum="0"
toolbarLocation="top"
pageSizeList="10,20,50"
xlsFileName="table1.xls"
showPrint="true"
filterable="false"
>
<ec:row style="text-align:center">
<ec:column width="5%" property="_0" title="序号" value="${GLOBALROWCOUNT}" style="text-algin:center" editable="false"/>
<ec:column width="40%" property="userid" title="用户标识" style="text-align:center" editable="false" sortable="true"/>
<ec:column width="40%" property="username" title="用户姓名" style="text-align:center" editable="false" sortable="true"/>
</ec:row>
<c:if test="${msg != null}">
<ec:extendrow>
<tr><td colspan="3" style="text-align:center"><strong><font face='宋体' color='#5b92fa'><c:out value="${msg}"/></font></strong></td></tr>
</ec:extendrow>
</c:if>
</ec:table><br>
</td>
</tr>
</table>
</body>
<script type="text/javascript">
function myrefresh()
{
ECSideUtil.reload('ec');
setTimeout('myrefresh()',10000); //指定1秒刷新一次 1000=1秒
}
setTimeout('myrefresh()',1000); //指定1秒刷新一次 1000=1秒
</script>
</html>
<!-- 接收已经经过数据库分页处理的List , 必须做设置 retrieveRowsCallback="limit" sortRowsCallback="limit" filterRowsCallback="limit" -->
POJO:
public class TestVO {
private String userid;//用户标识
private String username;//用户姓名
//分页用
private int startRow;
private int endRow;
private String order;
private String sort;
public int getEndRow() {
return endRow;
}
public void setEndRow(int endRow) {
this.endRow = endRow;
}
public String getOrder() {
return order;
}
public void setOrder(String order) {
this.order = order;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
public int getStartRow() {
return startRow;
}
public void setStartRow(int startRow) {
this.startRow = startRow;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
ACTION:
public class TestAction extends ActionSupport {
private MailService mailService;
public TestService getTestService() {
return testService;
}
public void setTestService testService;{
this.testService;= testService;
}
public String searchTestList() throws Exception {
HttpServletRequest request = ServletActionContext.getRequest();
TestVO vo=new TestVO();
Limit limit = RequestUtils.getLimit(request);
String sort=limit.getSort().getProperty();
String order=limit.getSort().getSortOrder();
int totalRows = RequestUtils.getTotalRowsFromRequest(request);
if (totalRows < 0) {
totalRows = mailService.countGetTestList(vo);
}
limit.setRowAttributes(totalRows, 20);
int offset = 0;
int[] rowStartEnd = new int[] { limit.getRowStart() + offset,limit.getRowEnd() + offset };
if (rowStartEnd[1] == 0) {
rowStartEnd[1] = 20;
}
vo.setStartRow(rowStartEnd[0]);
vo.setEndRow(rowStartEnd[1]);
vo.setOrder(order);
vo.setSort(sort);
List list = testService.getTestList(vo);
if(!list.isEmpty()){
request.setAttribute("list", list);
}else{
request.setAttribute("msg", "没有符合条件的记录!");
}
return SUCCESS;
}
}
相关推荐
ibatis_likehbm高效分页组件ibatis_likehbm高效分页组件ibatis_likehbm高效分页组件ibatis_likehbm高效分页组件ibatis_likehbm高效分页组件ibatis_likehbm高效分页组件 ibatis_likehbm高效分页组件 ibatis_likehbm...
iBATIS_DBL-2.2.0.638 iBatis src
iBATIS_API_DOC 帮助能手简单易用!
iBATIS_JPetStore-4.0.5
java_ibatis_example java ibatis 例子
iBATIS_in_Action iBATIS_in_Action iBATIS_in_Action iBATIS_in_Action
Ibatis 2.3.4 数据库无关分页 有示例,可以运行 网上找的很不错
ORACLE、IBATIS_20100914 ORACLE、IBATIS_20100914 ORACLE、IBATIS_20100914
Ibatis_3__最简单的示例.pdf Ibatis_3__最简单的示例.pdf
iBATIS_Database_Layer_开发指南
iBATIS_2.0_开发指南 iBATIS_2.0_开发指南
Spring、hibernate、iBATIS三种流行框架整合
Spring_Struts_Ibatis_Mysql Demo
IBATIS_IN_ACTION pdf参考书籍文档
hibernate下载 : http://sourceforge.net/projects/hibernate/files/hibernate3/--3.XX版本 ...IBATS下载地址:...比如:ibatis-2.3.0.677.jar, spring 可在下载你需要的版本: http://www.springsource.org/download
ibatis ibator eclipes插件 代码生成器 代码自动生成工具 下载后将features和plugins两个文件夹下的文件拷贝到eclipes安装路径下对应的features和plugins两个文件夹下即可
iBATIS_02_addSequence_add_del_update_sel_sellike
iBATIS 2.2.0 is the last release that includes the iBATIS DAO framework. After 2.2.0, the DAO iBATIS framework is removed from the downloads. We suggest converting iBATIS framework DAOs to the Spring ...
ibatis_struts2_spring_介绍
使用 SQL Map,能够大大减少访问关系数据库的代码。 SQL Map 使用简单的 XML 配置文件将 Java Bean 映射成 SQL 语句,对比其他的数据库持续层和 ORM 框架(如 JDO 的实现, Hibernate 等), SQL Map 最大的优点在于...