http://www.chinajavaworld.com/non-cgi/usr/48/48_3486.rar
解决方案 »
- 请问论坛有朋友做过流程可视化的开发项目吗
- 初学ibatis的问题:Document root element "sqlMap", must match DOCTYPE root "sqlMapConfig"
- 按条件查询
- jdk1.6怎么安装不了tomcat 4?
- mysql怎样一次删除两个字段
- 用JAVA读写和修改XML的代码问题
- hibernate 问题!!!
- ejb部署时配置XML文件的问题
- 急!!开发web时weblogic7.0的公共jar 文件放在哪个目录?我放在WEB-INF\lib下为什么系统找不到??
- 系统架构选择
- struts实现分页处理代码,急!在线等!解决便结并100分相送
- struts 分页显示问题
你说的问题和struts没有关系,和以前使用javabean实现分页的程序是一样的!
都没有描述府小弟我struts菜鸟一个啊 ◎◎ !!
1.
<html:hidden property="currpage"/>
<html:hidden property="rowsperpage"/>
<html:hidden property="totalpage"/>
<html:hidden property="prepage"/>
<html:hidden property="nextpage"/>
<html:hidden property="gotopage"/>2.
<table>
<tr>
<td><a href="#" onclick="goto(1);">首页</a></td>
<td><a href="#" onclick="goto(<bean:write name="statisticsForm" property="prepage"/>);">上页</a></td>
<td>当前第<bean:write name="statisticsForm" property="currpage"/>页</td>
<td><a href="#" onclick="goto(<bean:write name="statisticsForm" property="nextpage"/>);">下页</a></td>
<td><a href="#" onclick="goto(<bean:write name="statisticsForm" property="totalpage"/>);">尾页</a></td>
</tr>
</table>
3.
<script language="javascript">
<!--
function goto(pageno)
{
if(pageno > document.statisticsForm.totalpage.value) {
//alert("");
pageno = document.statisticsForm.totalpage.value
}
if(pageno == 0) {
pageno = 1;
}
document.statisticsForm.gotopage.value=pageno;
document.statisticsForm.submit();
}
-->
</script>4.Form Bean中:
import com.ebis.xjyd.util.form.PagingForm; MyForm extends PagingForm 5.Action中:
import com.ebis.xjyd.util.PagingUtil; // ↓↓↓↓↓↓↓↓↓↓以下分页需要
int gotoPage = 0;
if(statisticsForm.getGotopage().equals("")) {
gotoPage = 1;
}
else {
gotoPage = Integer.parseInt(statisticsForm.getGotopage());
}
int rowsPerPage = Integer.parseInt(statisticsForm.getRowsperpage());
statisticsForm.setNextpage("" + (gotoPage + 1));
statisticsForm.setCurrpage("" + gotoPage);
// ↑↑↑↑↑↑↑↑↑↑以上分页需要
/************
取得List
************/
// ↓↓↓↓↓↓↓↓↓↓以下分页需要
if((billfile_statistics_result_list.size() % rowsPerPage) == 0) {
statisticsForm.setTotalpage("" +
(Math.round(billfile_statistics_result_list.size()/rowsPerPage)));
}
else {
statisticsForm.setTotalpage("" +
(Math.round(billfile_statistics_result_list.size()/rowsPerPage) + 1));
}
statisticsForm.setPrepage("" + (gotoPage - 1));
Collection collection = PagingUtil.getSubCollection(
billfile_statistics_result_list, rowsPerPage, gotoPage);
// ↑↑↑↑↑↑↑↑↑↑以上分页需要