struts+extjs grid显示数据

 最近遇到一个问题,struts2+extjs结合时,grid不显示数据,后台已经展示sql语句了,用火狐调试没有错误,郁闷啊 求解答;

前台代码:

 Ext.onReady(function(){
     
     Ext.QuickTips.init();
     
        var pageSize=10;//定义每页显示的行数  
       var sm = new Ext.grid.CheckboxSelectionModel(); //CheckBox选择列
       var cm = new Ext.grid.ColumnModel([
       new Ext.grid.RowNumberer(),
       sm,//行号列
       {header:'ID',dataIndex:'id',width:100,align:'center',sortable:true},
    {header:'姓名',dataIndex:'pname',width:100,align:'center',sortable:true},
    {header:'密码',dataIndex:'ppass',width:140,align:'center',sortable:true},
    {header:'邮件',dataIndex:'pemail',width:140,align:'center',sortable:true},
    {header:'地址',dataIndex:'paddress',width:120,align:'center',sortable:true}
 
   ]);

   var store = new Ext.data.Store({
    proxy: new Ext.data.HttpProxy({url:'person!query.action'}),
    reader:new Ext.data.JsonReader(
    {
    totalroperty:'totalCount',
    root:'list'  
    },
    [
    {id:'id',mapping:'ID',type:'int'},
    {name:'pname',mapping:'pname',type:'string'},
    {name:'ppass',mapping:'ppass',type:'string'},
    {name:'pemail',mapping:'pemail',type:'string'},
    {name:'paddress',mapping:'paddress',type:'string'}
  
    ])
   });


 
 var gPanel = new Ext.grid.GridPanel({
    title:'person 管理',
    el:'grid',
    store:store,
    sm:sm,
    cm:cm,
    width:700,
    height:280,
    tbar:new Ext.Toolbar({
    pageSize:10,
    store:store,
    title:'工具栏',
     items:[
      {xtype:'tbseparator'},
      {pressed:true,text:'新增',onClick:save},
      {xtype:'tbseparator'},
      {pressed:true,text:'修改'},
      {xtype:'tbseparator'},
      {pressed:true,text:'删除'}
     ]
    }),
    bbar: new Ext.PagingToolbar({
        store: store,
        displayInfo: true,
        displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条',
        emptyMsg: "没有记录",
        pageSize:pageSize,                  
        prevText:"上一页",  
        nextText:"下一页",  
        refreshText:"刷新",  
        lastText:"最后页",  
        firstText:"第一页",  
        beforePageText:"当前页" 
        }) //页脚显示分页
   });// grid end
   
   gPanel.render();
   store.load({params:{start:0, limit:pageSize}});
 
   //添加学员
   function save(){
    var win = new Ext.Window({
       width:350,
       heigth:150,
       title:'添加雇员',
       iconCls : 'tabs',
       collapsible : true,
         plain : true,
         modal:true
      });
      //添加Form
      var addForm = new Ext.form.FormPanel({
       standardSubmit: true,
       layout:'form',
       height:200,
       buttonAlign:'center',
       labelAlign : 'right',
       region:'center',
       frame:true,
       defaultType : 'textfield',
       items:[
           {
           name:'person.pname',
           fieldLabel:'姓名',
           width:180,
              allowBlank : false,
              blankText:'姓名不能为空' //错误信息提示
         },
         {
          name:'person.ppass',
          width:180,
          inputType:'password',
          fieldLabel:'密码',
          allowBlank:false,
          blankText:''
         },
         {
          name:'person.pemail',
          width:180,
          fieldLabel:'邮件',
          allowBlank:false,
          blankText:''
         },
         {
           name:'person.paddress',
           width:180,
           fieldLabel:'地址',
           allowBlank:false,
           blankText:''
          }
        ],
       buttons:[{
        text:'确定',
        type:'submit',
        handler:function(){
         if(addForm.form.isValid()){
          addForm.form.doAction('submit',{
          url:'stu!save',
           method:'post',
           success:function(form,action){
             Ext.Msg.alert('提示','添加成功');
             store.reload();
             win.hide();
           }
          });
          win.hide();
          store.load({params:{start:0, limit:pageSize}}); //加载数据
         }
        }
       }
       ]
      });
      win.add({items:addForm});
      win.show();
  
   }
  
});

后台处理:

 /**
  * 显示所有的列表
  * @return
  * @throws Exception
  */
    public String query()  {
     Map<String,String> map=new HashMap<String, String>();
     PageBean bean = new PageBean(request.getParameter("start"),
    request.getParameter("limit"));
     try {
      
      boolean flag = PersonService.quryByMap(map, bean);
   if (flag) {
    list = (List<Person>) bean.getResultList();
    totalCount = bean.getTotal();
   }
   
        success=true;
      return SUCCESS;
  } catch (Exception e) {
  
   e.printStackTrace();
  }
  return null;
  
 }

 

配置文件:

<action name="person" class="lpc.action.PersonAction">
    <result name="success" type="json" >
   
    </result>
  </action>

 

求各位大侠,帮忙啊..
<action name="person" class="lpc.action.PersonAction">
    <result name="success" type="json" >
   
    </result>
  </action><action name="person" class="lpc.action.PersonAction">
    <result name="success" type="json" >
   
    </result>
  </action>

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值