// 页面配置
<script type="text/javascript" src="/webtest/dwr/engine.js" ></script>
 <script type="text/javascript" src="/webtest/dwr/util.js" ></script>
 <script type="text/javascript" src="/webtest/dwr/interface/DwrTest.js" ></script>
 <script type="text/javascript" src="/webtest/ext/adapter/ext/ext-base.js"></script>
 <script type="text/javascript" src="/webtest/ext/ext-all.js"></script>
 <script type="text/javascript" src="/webtest/js/custom_ext/DwrExt.js" ></script>

// EXT代码
Ext.onReady(function(){
    Ext.QuickTips.init();
    Ext.form.Field.prototype.msgTarget = 'side';
    var cfg = {dwr: DwrTest.getBean, autoLoad: 'true',
     fields:[
     {name: 'row'},
     {name: 'age', type: 'int', mapping: 'age'},
     {name: 'name', type: 'string', mapping: 'name'},
     {name: 'desc', type: 'string', mapping: 'desc'}
     ]
    };
    var store = new Ext.data.DWRStore(cfg);
   
    var cmcfg = [new Ext.grid.RowNumberer(),
    {header: '姓名', dataIndex: 'name', sortable: 'true'},
    {header: '年龄',dataIndex: 'age', menuDisabled: 'true'},
    {header: '描述',dataIndex: 'desc', menuDisabled: 'true'}
    ];
    var cm = new Ext.grid.ColumnModel(cmcfg);
   
    var grid = new Ext.grid.GridPanel({
     id: 'grid',
     cm: cm,
     viewConfig: {sortDescText: '降序',sortAscText: '升序',columnsText: '显示列'},
     sm: new Ext.grid.RowSelectionModel({
      singleSelect:true
     }),
     store: store,
     height: 500,
     renderTo: Ext.getBody(),
     layout: 'fit',
     loadMask: 'loading......',
 });

// 这里是测试用的JAVA类

public class DwrTest {

 public static List<TestBean> results = new ArrayList<TestBean>();
 
 static {
  TestBean bean = new TestBean();
  bean.setName("li");
  bean.setAge(25);
  bean.setDesc("li");
  results.add(bean);
  bean = new TestBean();
  bean.setName("zhang");
  bean.setAge(25);
  bean.setDesc("zhang");
  results.add(bean);
  bean = new TestBean();
  bean.setName("wang");
  bean.setAge(25);
  bean.setDesc("wang");
  results.add(bean);
  bean = new TestBean();
  bean.setName("liu");
  bean.setAge(25);
  bean.setDesc("liu");
  results.add(bean);
 }
 
 public List<TestBean> getBean() {
  return DwrTest.results;
 }

}