Struts extjs 3.3.1 reads the JSON file and extjsjson

Source: Internet
Author: User

Struts extjs 3.3.1 reads the JSON file and extjsjson

Json file and script code:

JsonSrc/jsonTxt1.json,

{    "personInfoList": [        {            "id": 0,            "name": "A",            "age": 12        },        {            "id": 1,            "name": "B",            "age": 32        },        {            "id": 2,            "name": "C",            "age": 2        }    ]}

ExtJS3.3/test4.html


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">



How can ExtJS integrate with Struts2 to obtain json data returned by an Action?

First you need to add two jar packages: json-lib, jar and struts2-json-plugin.jar. Second, the struts. xml configuration file extends = "json-default"

The json data transmitted by struts2 to extjs cannot be displayed.

Another problem is that the data in the list is much larger than the data defined here. I added it to you:
Var rd = new Ext. data. JsonReader ({
Root: 'root ',
TotalProperty: 'results ',
Id: 'id'
},[{
Name: 'id'
},{
Name: 'username'
},{
Name: 'Password'
},{
Name: 'booktime'
}]);
 

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.