re: Displaytag1.1大數據量分頁的例子 zJun's帛羅閣 2008-04-27 23:46
@xieamao
dao.query()中是使用Hibernate實現分頁的查詢,在有很多現成的實現。
re: Displaytag1.1大數據量分頁的例子 zJun's帛羅閣 2008-03-13 19:32
@yushibo
public class Page {
static private int DEFAULT_PAGE_SIZE = 15;
/**
* 每頁的記錄數
*/
private int pageSize = DEFAULT_PAGE_SIZE;
/**
* 當前頁第一條數據在List中的位置,從0開始
*/
private int start;
/**
* 當前頁中存放的記錄
*/
private List results;
/**
* 總記錄數
*/
private int totalCount;
/**
* 構造方法,只構造空頁
*/
public Page() {
this(0, 0, DEFAULT_PAGE_SIZE, new ArrayList());
}
/**
* 默認構造方法
*
* @param start
* 本頁數據在數據庫中的起始位置
* @param totalSize
* 數據庫中總記錄條數
* @param pageSize
* 本頁容量
* @param results
* 本頁包含的數據
*/
public Page(int start, int totalSize, int pageSize, List results) {
this.pageSize = pageSize;
this.start = start;
this.totalCount = totalSize;
this.results = results;
}
/**
* 取數據庫中包含的總記錄數
*/
public int getTotalCount() {
return this.totalCount;
}
/**
* 取總頁數
*/
public int getTotalPageCount() {
if (totalCount % pageSize == 0)
return totalCount / pageSize;
else
return totalCount / pageSize + 1;
}
/**
* 取每頁數據容量
*/
public int getPageSize() {
return pageSize;
}
/**
* 當前頁記錄
*/
public List getResults() {
return results;
}
/**
* 取當前頁碼,頁碼從1開始
*/
public int getCurrentPageNo() {
return start / pageSize + 1;
}
/**
* 是否有下一頁
*/
public boolean hasNextPage() {
return this.getCurrentPageNo() < this.getTotalPageCount() - 1;
}
/**
* 是否有上一頁
*/
public boolean hasPreviousPage() {
return this.getCurrentPageNo() > 1;
}
/**
* 獲取任一頁第一條數據的位置,每頁條數使用默認值
*/
protected static int getStartOfPage(int pageNo) {
return getStartOfPage(pageNo, DEFAULT_PAGE_SIZE);
}
/**
* 獲取任一頁第一條數據的位置,startIndex從0開始
*/
public static int getStartOfPage(int pageNo, int pageSize) {
return (pageNo - 1) * pageSize;
}
/**
* 設置總記錄數
*/
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
/**
* 設置記錄
* @param results
*/
public void setResults(List results) {
this.results = results;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
}
re: Displaytag1.1大數據量分頁的例子 zJun's帛羅閣 2008-02-29 20:31
re: Displaytag1.1大數據量分頁的例子 zJun's帛羅閣 2008-02-29 20:22
@迷途羔羊
排序是要自己寫代碼實現的,所以叫 external paging嘛。
@fenix
就靈活性和可擴展性來說,eXtremeComponents更好一些。
@佳佳
你好,我是用的displaytag1.1,應該有這兩個屬性的,或者你重新下載個displaytag的包看下:
<attribute>
<name>partialList</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>boolean</type>
<description>enable/disable partialLists. Valid values are true or false</description>
</attribute>
<attribute>
<name>size</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
Used only when partialList=true. Reference to the Integer object containing the size of the total dataset. Can
be an expression like requestScope.object.property. In the EL version of the taglibrary this must be an EL
expression which points to the source object.
</description>
</attribute>
@mm
<h3>前12筆記錄</h3>
<display:table name="test" length="12">
<display:column property="id" title="ID" />
<display:column property="email" />
<display:column property="status" />
</display:table>
可以看看displaytag的例子:
http://displaytag.homeip.net/displaytag-examples-1.1/example-subsets.jsp
re: 運用ajax技術的樹型菜單 zJun's帛羅閣 2006-07-31 16:37
是怎么構造樹的呢?是在tree_ajax.js和tree_htfl.js中嗎?哪里可以找到這兩個文件呢,這兩個文件所有的內容就是文章中提供的js文件的內容嗎?最好能提供這兩個文件的代碼。現在這樣看有點摸不著頭腦。
re: 我的第一次面試經歷 zJun's帛羅閣 2006-07-19 11:45
int ch = 'A' - 1;
for (int i = 1; i <= 26; i++) {
for (int j = 1; j <= i; j++) {
System.out.print((char) (ch + i));
}
System.out.println();
}
不是很復雜啊,是題目還有什么要求沒有寫出來嗎?