日期:2014-05-17  浏览次数:20728 次

请教关于extjs与struts2互相传递数据问题!
各位好。我的项目前台用的是extjs,后台是struts2+Spring+mybatis。我在界面上有个查询按钮,一点查询会将条件传递给后台,后台根据条件从数据库中找到相应的数据,并返回给前台。
下边是我的form
JScript code


function LoadForm(baseUrl)
   {     
           var fpProductSearch = new Ext.FormPanel({
           renderTo: 'searchDiv',
           id:"fpProductSearch",
           labelWidth: 75,
           frame:true,
           title: '产品搜索',
           bodyStyle:'padding:5px 5px 0',
           width: 350,
           defaults: {width: 230},
           defaultType: 'textfield',

           items: [{
                   fieldLabel: '产品名称',
                   emptyText:'B-5538(YAS023400)',
                   name: 'product.productname'
               }],
           buttons: [{
               id:"btnSearch",
               text: '查找',
               handler: function(){
               var baseParams = fpProductSearch.form.getValues();
               fpProduct.getForm().reset();
               Ext.Ajax.request({
                   url : baseUrl + '/productAction!SearchProduct',
                   method:"post",
                    params: baseParams,
                   success: function (response,options) {
                       obj = Ext.decode(response.responseText);
                       if(obj.success)
                           {
                           fpProduct.getForm().setValues(obj.message);
                           }else
                               {
                                       Ext.Msg.alert('错误', obj.message); 
                               }
                       },
                        failure: function(response,options) {   
                         Ext.Msg.alert('错误', response.statusText);   
                   }
               
               });
               
               }
           },{
               id:"btnSReset",
               text: '清空',
               handler: function(){
                   fpProductSearch.getForm().reset();
               }
           }]
       });


var fpProduct = new Ext.FormPanel({
           renderTo: 'resultDiv',
           labelAlign: 'top',
           frame:true,
           title: '产品信息编辑',
           bodyStyle:'padding:5px 5px 0',
           width: 960,
           items: [{
               layout:'column',
               items:[{
                   columnWidth:.25,
                   layout: 'form',
                   items: [{
                       xtype:'textfield',
                       fieldLabel: '产品名称',
                       name: 'productname',
                       anchor:'95%'
                   }, {
                       xtype:'textfield',
                       fieldLabel: '创建人',
                       name: 'creator',
                       anchor:'95%'
                   }
                   , {
                       xtype:'textfield',
                       fieldLabel: '客户',
                       name: 'customeruid',
                       anchor:'95%'
                   }
                   , {
                       xtype:'textfield',
                       fieldLabel: '拼板数量',
                       name: 'panelnum',
                       anchor:'95%'
                   }
                    , {
                       xtype:'textfield',
                       fieldLabel: '备注',
                       name: 'description',
                       anchor:'95%'
                   }]
               },{
                   columnWidth:.25,
                   layout: 'form',
                   items: [{
                       xtype:'textfield',
                       fieldLabel: '物料号',
                       name: 'productpartnumber',
                       anchor:'95%'
                   },{
                       xtype:'textfield',
                       fieldLabel: '创建时间',
                       name: 'createDateStr',