同時支持將已經讀取到的數據在顯示到表格之前進行處理,這個功能也是通過實現一個接口來達到
在JSP上可以不寫任何的JAVA代碼,也不需要直接在JSP頁面里面傳遞任何的參數,就可以顯示出完整的表格.
比較典型的JDBC分頁使用方式
??????? database.clearSql();
??????? database.setTablename("test");
??????? database.setFields("id");
??????? database.setFields("CODE");
??????? database.setFields("username");
??????? database.setFields("descript");
??????? database.setCondition("username<>' where group by'");
??????? //附加條件
??????? database.setAddons( " order by id desc");
?????? showTable.setInit(request, database,row, true);
?????? showTable.page(); //分頁
?????? showTable.setTableName("table1");
????? String[][] colname = { {"0","ID"},{"1","編號"}, {"2","姓名"}, {"3","描述"} }; //顯示的列名
??????
????? ?//生成表格
?????? String tableString1 = showTable.getTableString(colname,0,true,true,null);?
???
?????? String[][] queryString = { { "username", "姓名" }, { "CODE", "編號" },{ "descript", "描述" } };
??????
????? //生成快速查詢
????? String showQueryString = showTable.getQuery(queryString,"","",0);????
?????? 其中的database是一個接口,可以自由替換
以下的幾個表格就是根據具體設置的不同的參數顯示出的不同的效果.可以在生成表格之后,從JSP上往表格內接入JS的單擊或雙擊事件,單擊或雙擊事件時調用的JS函數可以從外部傳入(雙擊或單擊以下表格的行時,會有事件發生,這個事件可以由自己實現不同的效果)
ID | 編號 | 姓名 | 描述 | |
---|---|---|---|---|
Servlet: 7 | 10003 | f | the user f | |
Servlet: 6 | 10006 | e | the user e | |
Servlet: 5 | 10002 | d | the user d | |
Servlet: 4 | 10004 | c | the user c | |
Servlet: 3 | 10003 | b | the user b | |
Servlet: 2 | 10002 | a | the user a | |
Servlet: 1 | 10003 | shiwei | administrator |
<<<?1?>>>?共有1頁?7條記錄 ??轉到頁 ?每頁行 ??搜索的全部結果??顯示全部 |
administrator | admin | 10003 | |
the user a | a | 10002 | |
the user b | b | 10003 | |
the user c | c | 10004 | |
the user d | d | 10002 | |
the user e | e | 10006 | |
the user f | f | 10003 |
<<<?1?>>>?共有1頁?7條記錄 ??轉到頁 ?每頁行 ??搜索的全部結果??顯示全部 |
描述 | 姓名 | 編號 |
---|---|---|
administrator | admin | 10003 |
the user a | a | 10002 |
the user b | b | 10003 |
the user c | c | 10004 |
the user d | d | 10002 |
the user e | e | 10006 |
the user f | f | 10003 |
<<<?1?>>>?共有1頁?7條記錄 轉到頁 ?每頁行 ??顯示全部 |
the user a | a | 10002 |
the user b | b | 10003 |
the user c | c | 10004 |
the user d | d | 10002 |
the user e | e | 10006 |
the user f | f | 10003 |
administrator | admin | 10003 |
id | name | descript | |
---|---|---|---|
0 | 士大夫 | ewioruiew1 | |
1 | 搞活 | 346546 | |
2 | 士大夫感 | 456鬼畫符 | |
3 | 結核桿菌 | 457658768768 | |
4 | 飛過海臺 | 768768 | |
5 | 單峰駝人 | 3454545 | |
6 | 兒童 | 4他 |
<<<?1?2?>>>?共有2頁?11條記錄 ??轉到頁 ?每頁行 ??搜索的全部結果??顯示全部 |