資源簡(jiǎn)介
applicationContext_common.xml文件中修改hibernate數(shù)據(jù)庫(kù)配置;
數(shù)據(jù)庫(kù)為mysql,其他數(shù)據(jù)庫(kù)如oracle,請(qǐng)自行修改。
代碼片段和文件信息
package?com.slms.action;
import?java.util.ArrayList;
import?java.util.List;
import?com.opensymphony.xwork2.ActionSupport;
public?class?baseAction?extends?ActionSupport?{
//?當(dāng)前頁(yè)
private?Integer?currPage?=?1;
//?每頁(yè)的條數(shù)
private?Integer?pageSize?=?3;
//?總條數(shù)
private?Integer?totalRecords?=?0;
//?總頁(yè)數(shù)
private?Integer?totalPage?=?0;
//?分頁(yè)后將要被顯示到頁(yè)面的數(shù)據(jù)
List?pageList?=?new?ArrayList();
//?分頁(yè)顯示的文字信息
private?StringBuilder?pager?=?new?StringBuilder();
public?List?paging(List?allPageList)?{
totalRecords?=?allPageList.size();
int?totalPage?=?(totalRecords?+?(pageSize?-?1))?/?pageSize;
if?(currPage?>?totalPage)?{
currPage?=?totalPage;
}
if?(currPage?1)?{
currPage?=?1;
}
int?startIndex?=?(currPage?-?1)?*?pageSize;
pageList.clear();
for?(;?(startIndex? pageList.add(allPageList.get(startIndex));
}
pager.append(“ript?type=‘text/javascript‘>“);
pager.append(“function?goPage(page){var?curPage?=?document.getElementById(‘currPage‘);curPage.value=page;document.forms[0].submit();}“);
pager.append(“function?goTxtPage(){goPage(document.getElementById(‘txtPage‘).value);}“);
pager.append(“ ript>“);
pager.append(““);
pager.append(““);
pager.append(“總共數(shù)“?+?totalRecords?+?“記錄共“+totalPage+“頁(yè)每頁(yè)“?+?pageSize?+?“條當(dāng)前第“
+?currPage?+?“頁(yè).“);
if?(currPage?!=?1)?{
pager.append(“vascript:void(0);‘?onclick=‘goPage(1)‘>首頁(yè) “);
pager.append(“vascript:void(0);‘?onclick=‘goPage(“
+?(currPage?-?1)?+?“)‘>上一頁(yè) “);
}
for?(int?i?=?currPage?-?5;?i? if?(i?>?0?&&?i?<=?totalPage)?{
pager.append(“vascript:void(0);‘?onclick=‘goPage(“
+?i?+?“)‘>“?+?i?+?“ “);
}
}
if?(currPage?!=?totalPage)?{
pager.append(“vascript:void(0);‘?onclick=‘goPage(“
+?(currPage?+?1)?+?“)‘>下一頁(yè) “);
pager.append(“vascript:void(0);‘?onclick=‘goPage(“
+?totalPage?+?“)‘>最后頁(yè) “);
}
pager.append(“tle=‘請(qǐng)輸入你要跳轉(zhuǎn)的頁(yè)碼然后點(diǎn)GO‘?/>click=‘goTxtPage();‘?/>“);
pager.append(“
“);
return?pageList;
}
/**
?*?用于子類方法覆蓋用
?*?
?*?@return
?*/
public?List?getAllPageList()?{
return?new?ArrayList();
}
public?List?paging()?{
return?paging(getAllPageList());
}
public?Integer?getCurrPage()?{
return?currPage;
}
public?void?setCurrPage(Integer?currPage)?{
this.currPage?=?currPage;
}
public?String?getPager()?{
return?pager.toString();
}
public?List?getPageList()?{
return?pageList;
}
public?Integer?getPageSize()?{
return?pageSize;
}
public?void?setPageSize(Integer?pageSize)?{
this.pageSize?=?pageSize;
}
public?Integer?getTotalRecords()?{
return
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-04-16?14:34??jxc\
?????文件?????????838??2012-05-07?10:39??jxc\.classpath
?????文件????????1036??2012-05-07?10:39??jxc\.project
?????目錄???????????0??2012-07-17?16:03??jxc\.settings\
?????文件?????????454??2012-05-07?10:39??jxc\.settings\.jsdtscope
?????目錄???????????0??2012-07-17?16:03??jxc\.settings\CVS\
?????文件?????????404??2012-05-31?11:20??jxc\.settings\CVS\Entries
?????文件??????????15??2012-05-31?11:20??jxc\.settings\CVS\Repository
?????文件??????????31??2012-05-31?11:20??jxc\.settings\CVS\Root
?????文件?????????330??2012-05-07?10:39??jxc\.settings\org.eclipse.jdt.core.prefs
?????文件?????????439??2012-05-07?10:39??jxc\.settings\org.eclipse.wst.common.component
?????文件?????????320??2012-05-07?10:39??jxc\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件??????????49??2012-05-07?10:39??jxc\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件???????????6??2012-05-07?10:39??jxc\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????目錄???????????0??2012-07-17?16:03??jxc\build\
?????目錄???????????0??2012-07-17?16:03??jxc\build\classes\
?????文件????????3992??2012-05-17?10:11??jxc\build\classes\applicationContext_beans.xm
?????文件????????2714??2012-05-16?15:42??jxc\build\classes\applicationContext_common.xm
?????目錄???????????0??2012-07-17?16:03??jxc\build\classes\com\
?????目錄???????????0??2012-07-17?16:03??jxc\build\classes\com\slms\
?????目錄???????????0??2012-07-17?16:03??jxc\build\classes\com\slms\action\
?????文件????????3770??2012-06-20?11:43??jxc\build\classes\com\slms\action\ba
?????文件????????3588??2012-06-20?11:43??jxc\build\classes\com\slms\action\ClientAction.class
?????文件????????3661??2012-06-20?11:43??jxc\build\classes\com\slms\action\EmployeeAction.class
?????文件????????3421??2012-06-20?11:43??jxc\build\classes\com\slms\action\MerchandiseAction.class
?????文件????????6998??2012-06-20?11:43??jxc\build\classes\com\slms\action\StockinAction.class
?????文件????????6948??2012-06-20?11:43??jxc\build\classes\com\slms\action\StockorderAction.class
?????目錄???????????0??2012-07-17?16:03??jxc\build\classes\com\slms\common\
?????文件?????????881??2012-06-20?11:43??jxc\build\classes\com\slms\common\ba
?????文件?????????607??2012-06-20?11:43??jxc\build\classes\com\slms\common\ChkUtil.class
?????目錄???????????0??2012-07-17?16:03??jxc\build\classes\com\slms\dao\
............此處省略186個(gè)文件信息
評(píng)論
共有 條評(píng)論