Struts自定义分页标签 翻页的时候如何提交表单 当点击翻页按钮的时候如何提交表单,除了用session的方式 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 点击下一页 submit 不过要带上当前页数 和每页记录数 这2个参数 提交表单一样的提交呀!你的自定义标签有加form吧?然后触发一个事件! 最好是贴下你的分页代码,我是没有用form <div class="nextprepage mb15"><pages:pages cpage="${cpage}" total="${total}"allCount="${allCount}" url="hotel_access_list_list.action?" showCount="${showCount}" />这个使用的是struts自定义标签做的 http://www.360doc.com/content/09/0707/16/117897_4176357.shtml基本方式跟这个一样 现在一个疑惑就是 当你搜索的时候,然后翻页,表单如何提交 搜索的时候把条件加上,一起提交的后台。然后把分页信息的offset和limit,也要提交。 貌似你还没懂我的意思 你先百度下struts自定义分页标签 完了再回答 我就是问你struts分页标签如何把查询条件提交到后台? String style = "style=\"color: #F60;text-decoration: underline;border: 1px solid #F60;\""; // 上一页 if(cpageInt<=totalInt){ if(cpageInt>1) str.append("<li><a href='"+ this.url+"total=" + this.total + "&cpage=" + (cpageInt - 1) +"&showCount="+this.showCount+ "'><上一页</a></li><ul>"); } if (totalInt <= 5) {// 页数小于5 for (int i = 1; i <= totalInt; i++) { str.append("<li><a "+(cpageInt==i?style:"")+" href='" + this.url + "" + "total=" + this.total + "&cpage=" + i +"&showCount="+this.showCount+"'>" + i + "</a></li>"); } } else {// 页数大于5 if (cpageInt <= 3) { for (int i = 1; i <= 5; i++) { str.append("<li><a "+(cpageInt==i?style:"")+" href='" + this.url + "" + "total=" + this.total + "&cpage=" + i +"&showCount="+this.showCount+"'>" + i + "</a></li>"); } }else if(cpageInt>=totalInt-2){ for (int i = totalInt - 4; i <= totalInt; i++){ str.append("<li><a "+(cpageInt==i?style:"")+" href='" + this.url + "" + "total=" + this.total + "&cpage=" + i +"&showCount="+this.showCount+"'>" + i + "</a></li>"); } }else{ for (int i = cpageInt - 2; i <= cpageInt+2; i++){ str.append("<li><a "+(cpageInt==i?style:"")+" href='" + this.url + "" + "total=" + this.total + "&cpage=" + i +"&showCount="+this.showCount+ "'>" + i + "</a></li>"); } } } // 下一页 if(cpageInt<totalInt){ str.append("<li><a href='"+ this.url+"total=" + this.total + "&cpage=" + (cpageInt + 1) +"&showCount="+this.showCount+ "'>下一页></a></li><ul></div>"); }这个是分页部分源代码 触发JS函数就行fanye(pageNum,tiaojian){window.location.href=xxx.do?pege=pageNum&tiaojian=tiaojian;}只要传页面的查询条件,和你想要跳转到的页码就可以了。后台处理完成后,记得要把查询条件传到前台显示出来,以便下次翻页的时候再次传值。 你这样不是get传值了吗?如果遇到中文字? spring事务求解 求页面高手-动态表格 ext怎样获取combox当前选中项的值 struts2 singleton 请问如何实现不刷新页面,只刷新页面中的数据?谢谢! jQuery easyui 表单验证打开页面就验证 linux+jboss3.0.7版本+mysql 乱码如何处理??? 分页按条件搜索的问题? 用tomcat做服务,在浏览过程中,页面刷的一下没有了。大家知道这是怎么回事? 关于JSON解析器 如何将Struts2 select标签 的值存入数据库? session过期问题
你的自定义标签有加form吧?
然后触发一个事件!
<pages:pages cpage="${cpage}" total="${total}"allCount="${allCount}" url="hotel_access_list_list.action?" showCount="${showCount}" />
这个使用的是struts自定义标签做的
String style = "style=\"color: #F60;text-decoration: underline;border: 1px solid #F60;\"";
// 上一页
if(cpageInt<=totalInt){
if(cpageInt>1)
str.append("<li><a href='"+ this.url+"total="
+ this.total
+ "&cpage=" + (cpageInt - 1) +"&showCount="+this.showCount+ "'><上一页</a></li><ul>");
}
if (totalInt <= 5) {// 页数小于5
for (int i = 1; i <= totalInt; i++) {
str.append("<li><a "+(cpageInt==i?style:"")+" href='" + this.url
+ "" + "total=" + this.total + "&cpage="
+ i +"&showCount="+this.showCount+"'>" + i + "</a></li>");
}
} else {// 页数大于5
if (cpageInt <= 3) {
for (int i = 1; i <= 5; i++) {
str.append("<li><a "+(cpageInt==i?style:"")+" href='" + this.url
+ "" + "total=" + this.total + "&cpage="
+ i +"&showCount="+this.showCount+"'>" + i + "</a></li>");
}
}else if(cpageInt>=totalInt-2){
for (int i = totalInt - 4; i <= totalInt; i++){
str.append("<li><a "+(cpageInt==i?style:"")+" href='" + this.url
+ "" + "total=" + this.total + "&cpage="
+ i +"&showCount="+this.showCount+"'>" + i + "</a></li>");
}
}else{
for (int i = cpageInt - 2; i <= cpageInt+2; i++){
str.append("<li><a "+(cpageInt==i?style:"")+" href='" + this.url
+ "" + "total=" + this.total + "&cpage="
+ i +"&showCount="+this.showCount+ "'>" + i + "</a></li>");
}
}
}
// 下一页
if(cpageInt<totalInt){
str.append("<li><a href='"+ this.url+"total="
+ this.total
+ "&cpage=" + (cpageInt + 1) +"&showCount="+this.showCount+ "'>下一页></a></li><ul></div>");
}
这个是分页部分源代码
fanye(pageNum,tiaojian){window.location.href=xxx.do?pege=pageNum&tiaojian=tiaojian;
}
只要传页面的查询条件,和你想要跳转到的页码就可以了。后台处理完成后,记得要把查询条件传到前台显示出来,以便下次翻页的时候再次传值。
你这样不是get传值了吗?如果遇到中文字?