package com.ldl.action;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.googlecode.jsonplugin.annotations.JSON;
import com.opensymphony.xwork2.Action;
public class BigPageAction {
private static Integer NUM = 100;
private Map json = new HashMap();
private Integer toPage;
private Integer pageSize;
private String keyword;
public String getData1(){
List<String []> list = new ArrayList<String []>();
for(int i=0;i<NUM;i++){
list.add(new String[]{"公司" + i,"www.add"+i + ".com","2"+i,"3"+i});
}
String[][] data = null;
data = list.toArray(new String[list.size()][4]);
json.put("data", data);
return Action.SUCCESS;
}
public String getData2(){
List<String []> list = new ArrayList<String []>();
for(int i=0;i<NUM;i++){
list.add(new String[]{"公司" + i,"www.add"+i + ".com","2"+i,"3"+i});
}
if(toPage < 1){
toPage = 1;
}
if(pageSize < 1){
pageSize = 50;
}
Integer start = (toPage - 1)*pageSize;
Integer end = toPage*pageSize;
int c = 0 ;
for (Iterator iterator = list.iterator(); iterator.hasNext();) {
String[] strings = (String[]) iterator.next();
if(keyword != null && strings[0].indexOf(keyword) == -1){
c ++;
iterator.remove();
}
}
String[][] data = null;
if(start > NUM -c){
json.put("data", data);
json.put("totalRecord", 0);
return Action.SUCCESS;
}
if(end > NUM -c)end = NUM -c;
List<String []> list1 = list.subList(start, end);
data = list1.toArray(new String[list1.size()][4]);
json.put("data", data);
json.put("totalRecord", NUM - c);
return Action.SUCCESS;
}
public Map getJson() {
return json;
}
public void setJson(Map json) {
this.json = json;
}
public Integer getToPage() {
return toPage;
}
public void setToPage(Integer toPage) {
this.toPage = toPage;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
ajaxPage.zip (40个子文件)
ajaxPage
bigPage
.classpath 951B
.settings
com.genuitec.eclipse.j2eedt.core.prefs 1KB
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.jdt.core.prefs 330B
org.eclipse.core.resources.prefs 88B
.jsdtscope 500B
org.eclipse.wst.jsdt.ui.superType.container 49B
.mymetadata 295B
src
struts.xml 617B
com
ldl
action
BigPageAction.java 2KB
WebRoot
page1.html 3KB
WEB-INF
classes
struts.xml 617B
com
ldl
test
SimpleTest.class 2KB
SimpleTest$1.class 819B
action
BigPageAction.class 3KB
lib
jsonplugin-0.32.jar 45KB
freemarker-2.3.8.jar 784KB
ognl-2.6.11.jar 164KB
commons-logging-1.1.jar 52KB
struts2-core-2.0.8.jar 2.1MB
xwork-2.0.3.jar 447KB
web.xml 777B
index.jsp 834B
main.html 1KB
struts
page2.jsp 3KB
page3.jsp 3KB
page1.jsp 3KB
page4.jsp 3KB
js
jquery.bigpage.js 11KB
jquery.js 115KB
page5.html 3KB
page6.html 4KB
page3.html 3KB
css
bigpage.css 761B
page4.html 3KB
page2.html 3KB
main.jsp 2KB
META-INF
MANIFEST.MF 36B
data.html 111B
.project 1KB
.myeclipse
共 40 条
- 1
资源评论
小小哭包
- 粉丝: 1902
- 资源: 3901
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- vscode-1.64.1.tar源码文件
- vscode-1.64.0.tar源码文件
- vscode-1.52.0.tar源码文件
- Music-Player +PlayerActivity+ rockplayer+ SeeJoPlayer 播放器JAVA源码
- vscode-1.46.0.tar源码文件
- 最近很火植物大战僵尸杂交版2.08苹果+安卓+PC+防闪退工具V2+修改工具+高清工具+通关存档整合包更新
- 超级好用的截图工具PixPin,可录制Gif图
- Screenshot_2024-05-21-17-06-42-64_2332cb9b27b851b548ba47a91682926c.jpg
- 毕业设计参考 - 基于树莓派、OpenCV及Python的人脸识别
- node-v18.20.2-linux-arm64
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功