前提准备:
1.struts2必备Jar包
2.struts2 Json插件
json-plugin 可以转换action的返回结果为json数据,恰好配合extjs 的store进行数据的交互。
一、Java代码
1.User.java
package com.yalone.test.ext;
public class User {
private String firstName;
private String lastName;
private int age;
private String email;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
2.GridTestAction.java
package com.yalone.test.ext;
import java.util.ArrayList;
import com.opensymphony.xwork2.ActionSupport;
public class GridTestAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private boolean flag;
private ArrayList<User> users;
private int total;
private int start;
private int limit;
public boolean isFlag() {
return flag;
}
pu