/** 
* 会议管理-已发会议前台界面 
* @author wj $ 
* @version 1.0.0.0 $ 
* @date: 2009/03/02 $ 
*/ Ext.onReady(function(){ 
    Ext.QuickTips.init(); 
    Ext.BLANK_IMAGE_URL = "../syssetting/resources/images/default/s.gif"; 
    
    
    function RootPath(){ 
    var strFullPath=window.document.location.href; 
    var strPath=window.document.location.pathname; 
    var pos=strFullPath.indexOf(strPath); 
    var prePath=strFullPath.substring(0,pos); 
    var postPath=strPath.substring(0,strPath.substr(1).indexOf('/')+1); 
    return(prePath+postPath); 
    }; 
    var fm = Ext.form; 
var sm = new Ext.grid.CheckboxSelectionModel({handleMouseDown: Ext.emptyFn});     var cm = new Ext.grid.ColumnModel([ 
sm,{ 
header:'题目编号', 
resizable:false, 
align:'center', 
dataIndex:'id', 
width:30 
},{ 
header:'题目内容', 
resizable:true, 
minLength : 1, 
minLengthText : '222',  
align:'center', 
dataIndex:'title', 
width:130 
},{ 
header:'题目分数', 
resizable:true, 
minLength : 1, 
minLengthText : '222',  
align:'center', 
dataIndex:'score', 
width:130 

    ]);     cm.defaultSortable = true; 
    var Member = Ext.data.Record.create([ 
          {name: 'id', type: 'int'}, 
          {name: 'title', type: 'string'}, 
          {name: 'score', type: 'int'} 
          
      ]); var store = new Ext.data.JsonStore({ 
url: RootPath() + '/titleList.do', 
totalProperty:'count', 
root:'members', 
fields:Member, 
        pruneModifiedRecords:true, 
sortInfo: {field: "id", direction: "DESC"} 
}); //表单窗体 
var queryMetWindow; 
    var grid = new Ext.grid.EditorGridPanel({ 
        store: store, 
        cm: cm, 
        renderTo: 'member_grid', 
        resizeable:true, 
width:730, 
        height:540, 
        title:'所有题目列表查询', 
        frame:true, 
        clicksToEdit:0, 
sm:sm, 
iconCls:'icon-grid', 
loadMask: true, 
stripeRows:true, 
tbar:[ 
/*{//保存按钮 
text:'保存', 
iconCls:'user_add', 
handler:function(){ 
document.location.href="saveTest.do"; 

},'-',*/ 

  
id:'saveTitle', 
text:' 保存', 
iconCls:'save', 
handler:function(){ 
    var ids = []; 
var sm = grid.getSelectionModel(); 
var selected = sm.getSelections(); 
if(selected.length == 0){Ext.Msg.alert("移动温馨提示","请选择生成试卷的题目"); return;} else { 
var reSendContent = ""; 
for(var i=0;i <selected.length;i+=1){ 
var member = selected[i].data; 
if(member.id) { 
ids.push(member.id); 
    } } 
document.location.href="saveTest.do?ids="+ids; 


                  
},'-'], 
    bbar: new Ext.PagingToolbar({ 
        pageSize:20, 
        store: store, 
        displayInfo: true, 
        displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条', 
        emptyMsg: "没有记录" 
    })     }); 
    store.load({params:{start:0,limit:20}}); 
      
}); 
document.location.href="saveTest.do?ids="+ids;数据传不到后台 
配置文件没错 
配置文件这样写的: 
<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"> 
<struts-config> 
<action-mappings> 
<action input="/newSingleChange.jsp" path="/newSingleChange" 
scope="request" type="mobileMessage.action.NewSingleChangeAction"> 
<forward name="success" path="/home/baccy/Sendsuccess.jsp" /> 
</action> <action input="/changeTitleFailure.jsp" path="/titleList" 
scope="request" type="mobileMessage.action.TitleListAction"> 
<forward name="success" path="/home/baccy/Sendsuccess.jsp" /> 
</action> <action input="/home/meetingManage/titleList.jsp" path="/saveTest" 
scope="request" type="mobileMessage.action.SaveTitleAction"> 
<forward name="success" path="/home/meetingManage/examInfo.jsp" /> 
</action> 
</action-mappings> </struts-config> 

解决方案 »

  1.   

    var reSendContent = ""; 
    for(var i=0;i <selected.length;i+=1){ 
        var member = selected[i].data; 
        if(member.id) { 
           ids.push(member.id); 
        } 

    alert(ids);
    看你代码真累。。先alert一下看看是不是对象有数据没,数据是什么。确认一下是否有数据。如果有数据,还不能正确读取。说明你传递的json格式有误? 我倒没这么用过,你传递字符串连接串应该也可以解决问题,比如str1&str2&str3类似这样的字符串,服务器再解析。