近期做一个项目
在做一个ftl分页文件,想所有的分页都用这个FTL文件实现
用的是无刷新
问题是 比如一个查询数据库 需要参数1,我在第一次调用action的时候能抓到参数1并且获得数据库内信息分页,然后当我点下一页的时候,参数1获取不到了 这个怎么办
第一次调用action的方法:
 function test1(){
var url = "oracleAction.action?currentPage=1";
var form = $("#form3");
var formData = form.serialize();
alert(formData);
jQuery.post(url, formData, function(data) {
$("#div1").html(data);
    },"JSON");
 }
下一页:
function pagination(currentPage){
     var currentPage=currentPage;
var url = "oracleAction.action?currentPage="+currentPage;
var form = $("#form3");
var formData = form.serialize();
alert(formData);
jQuery.post(url, formData, function(data) {
$("#show").html(data);
    },"JSON");
action:
int pageSize = 2;
this.name = getName();
if(name.equals("")){
name = (String) ActionContext.getContext().getSession().get("name");
}else{
ActionContext.getContext().getSession().put("name", name);
}

System.out.println("name!!!!!!");
System.out.println(name);

//调用count方法计算总数
// int totalNumber=testService.countOpNumber((short)-1, "", "", (short)-1);
int totalNumber=testService.countOpNumber(Short.parseShort(name), "", "", (short)-1);
System.out.println("totalNum"+totalNumber);
//生成basepage
// BasePage bp=new BasePage(currentPage,totalNumber,10);
// //当前页
// currentPage=bp.getCurrentPage();
System.out.println("currentPage********");
System.out.println(currentPage);
// totalPages=bp.getTotalPages();
// List userList = testService.getUsers((short)-1, "", "", (short)-1, currentPage, pageSize, null, true);
List userList = testService.getUsers(Short.parseShort(name), "", "", (short)-1, currentPage, pageSize, null, true);
System.out.println("*********************");
System.out.println("listSize"+userList.size());

Map<String, Object> map = new HashMap<String, Object>();
Pagination p = new Pagination(currentPage, pageSize, totalNumber, userList);
//title
List list = new ArrayList();
list.add("index");
list.add("areaName");
list.add("loginName");
list.add("ID");
list.add("name");
list.add("123");
list.add("userNo");
map.put("result",p);
map.put("title", list);
JSONObject jo = JSONObject.fromObject(map);
result = "action result";
ActionContext.getContext().put("map", map);
stuList = userList;
return SUCCESS;