Complete example of using ExtJs to dynamically load a grid _ extjs

Source: Internet
Author: User
How to Implement Dynamic Loading of grid in ExtJs seems to be unknown to many friends. The following is a good example. I hope to help you with the complete Ext3.3 package.

Ext3.3 Chinese Document

The data table structure is: table> record> Field

Store Structure: Ext. data. Store> Ext. data. Record> Ext. datafield

Store first drives DataProxy to load data. After DataProxy is loaded, it will parse the data row and finally obtain the Record object.

1. bean:

The Code is as follows:


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

The Code is as follows:


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 ("Zhang San", 29, "male", "1990-10-22 ");
Person p2 = new Person ("Li Si", 28, "male", "1991-03-30 ");
Person p3 = new Person ("Wang Wu", 27, "female", "1993-08-17 ");
This. items = new ArrayList ();
This. items. add (p1 );
This. items. add (p2 );
This. items. add (p3 );

Return SUCCESS;
}
}


3. struts-xml

The Code is as follows:



Http://struts.apache.org/dtds/struts-2.1.dtd>











4. xml

The Code is as follows:








Struts2
Org. apache. struts2.dispatcher. ng. filter. StrutsPrepareAndExecuteFilter



Struts2
*. Action






5. jsp

The Code is as follows:


<% @ Page language = "java" import = "java. util. *" pageEncoding = "UTF-8" %>



Use ExtJs with Struts2

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.