<script type="text/javascript">
 var consume=new Array();//存放商品的数组
 var iTempCoumnt = 0;//商品数量统计的变量!
  function AddGoods(){
   var gBarCode=document.getElementById("txt_gBarCode").value
            var eq1=/\d/g;
             if(!eq1.test(gBarCode)){
               alert("商品条形码只能是数字!")
               return false;
             }
    //dwr发布的js对象调用后台业务类的方法(注意!dwr不支持方法重载,不支持非基本数据类型!)
            goodsInfoServiceImpl.findByGbarCode("gbarCode", gBarCode, callbacks);
  }
  function callbacks(data){
   alert(data[0].gid);
   alert(data[0].tabGoodsType);
   consume[iTempCoumnt]=data[0];
   iTempCoumnt++;
   var tbl=document.getElementById("consumeTbl");//取得tbody对象
   DWRUtil.removeAllRows('consumeTbl');//清空tbody的数据
   for(var n=0;n<consume.length;n++){
    var newRow = tbl.insertRow();//创建一行
    var newCell2 = newRow.insertCell();//在一行里面创建一列
    newCell2.innerText = consume[n].gname;//在一列里面添加数据
    var newCell3 = newRow.insertCell();
    newCell3.innerText = consume[n].gbarCode;
    var newCell4 = newRow.insertCell();
    newCell4.innerText = consume[n].tabGoodsType.gtypeName;
   }
  }
 </script>newCell4.innerText = consume[n].tabGoodsType.gtypeName;
consume[n].tabGoodsType对象是空的