ExtJs 实现动态加载grid完整示例_extjs

WBOY
Lepaskan: 2016-05-16 17:21:41
asal
1227 orang telah melayarinya
Ext3.3完整包

Ext3.3中文文档

数据表的结构是:数据表table > 记录record > 字段

store的结构是: Ext.data.Store > Ext.data.Record>Ext.dataDataField

store 首先驱动 DataProxy 加载数据 ,DataProxy加载完成会驱动 DataReader时行解析,最终获得Record对象。

1.bean :
复制代码 代码如下:

package com.leo.bean;

public class Person {
private String name;
private int age;
private String sex;
private String birthday;

public Person(String name, int age, String sex, String birthday) {
super();
this.name = name;
this.age = age;
this.sex = sex;
this.birthday = birthday;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public String getSex() {
return sex;
}

public void setSex(String sex) {
this.sex = sex;
}

public String getBirthday() {
return birthday;
}

public void setBirthday(String birthday) {
this.birthday = birthday;
}

}

2.action
复制代码 代码如下:

package com.leo.action;

import java.util.ArrayList;
import java.util.List;

import com.leo.bean.Person;
import com.opensymphony.xwork2.ActionSupport;

public class ExtjsAction extends ActionSupport {
private long results;
private List items;

public long getResults() {
return results;
}

public void setResults(long results) {
this.results = results;
}

public List getItems() {
return items;
}

public void setItems(List items) {
this.items = items;
}

public String execute() throws Exception {
this.results = 3;
Person p1 = new Person("张三", 29, "男", "1990-10-22");
Person p2 = new Person("李四", 28, "男", "1991-03-30");
Person p3 = new Person("王五", 27, "女", "1993-08-17");
this.items = new ArrayList();
this.items.add(p1);
this.items.add(p2);
this.items.add(p3);

return SUCCESS;
}
}

3.struts-xml
复制代码 代码如下:


BR>"http://struts.apache.org/dtds/struts-2.1.dtd">











4.xml
复制代码 代码如下:







struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter



struts2
*.action






5.jsp
复制代码 代码如下:





ExtJs与Struts2结合









图示:
ExtJs 实现动态加载grid完整示例_extjs
Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan