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'
}]);