Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jqgrid 使用struts2将arraylist从jsp传递给action类_Jqgrid_Struts2 - Fatal编程技术网

Jqgrid 使用struts2将arraylist从jsp传递给action类

Jqgrid 使用struts2将arraylist从jsp传递给action类,jqgrid,struts2,Jqgrid,Struts2,我有一个带有jqgrid的jsp页面,我想将该网格数据传递给action类。我正在使用cellEdit编辑jqgrid数据,现在我想将此新数据传递给action类以更新数据库中的数据。如何将jqgrid数据从jsp传递给action类 <sjg:grid id="gridtable" caption=" " dataType="json" href="%{listurl}" gridModel="listMS_AUTONU

我有一个带有jqgrid的jsp页面,我想将该网格数据传递给action类。我正在使用cellEdit编辑jqgrid数据,现在我想将此新数据传递给action类以更新数据库中的数据。如何将jqgrid数据从jsp传递给action类

 <sjg:grid id="gridtable" caption=" " dataType="json" 
                href="%{listurl}"
                gridModel="listMS_AUTONUMBER"
                            cellEdit="true"
                    cellurl="%{cellediturl}">

<sjg:gridColumn frozen="false"  name="autonumberCd" index="autonumberCd" title="%{getText('autonumber.autonumbercode')}"
                    sortable="true" search="true" editable="true" key="true" editoptions="{maxlength :2}"
                    editrules="{required:true,custom:true,custom_func:validateCapitalAlphanumeric}" formatter="String"  formoptions="{elmsuffix:'  *'}"/>     

                <sjg:gridColumn name="autonumberNm" index="autonumberNm" title="%{getText('autonumber.autonumbername')}"
                    sortable="true" editable="true" edittype="text" editrules="{required:true}" editoptions="{maxlength :10}" formoptions="{elmsuffix:'  *'}" />        

                <sjg:gridColumn name="nextAutonumber" index="nextAutonumber" title="%{getText('autonumber.nextautonumber')}"
                    sortable="true" editable="true" edittype="text" editrules="{required:true,custom:true,custom_func:validateNumericOnly}" editoptions="{maxlength :10}" align="right" formoptions="{elmsuffix:'  *'}" />                      
            </sjg:grid>


这是我的jqgrid,其中
listMS\u AUTONUMBER
是从数据库检索值并来自另一个操作类的列表。

要将jqgrid数据从jsp传递到操作类,我使用json,如下所示:

var data=jQuery("#gridtable").jqGrid('getRowData');      //this method gets all the data from grid
var postData = JSON.stringify(data);          //using json stringify convert the data in string format
alert(postData);
$.ajax({
       type: "Get",
    url: "action_name?AutoList="+postData,
    data : {
           jgGridData: postData,
        },
    dataType:"json",
    contentType: "application/json; charset=utf-8",
});
JSONArray outerArray = (JSONArray) JSONSerializer.toJSON(AutoList); 
我使用alert以字符串格式显示jqgrid的数据

之后,我将通过AJAX将此数据发送到action类,如下所示:

var data=jQuery("#gridtable").jqGrid('getRowData');      //this method gets all the data from grid
var postData = JSON.stringify(data);          //using json stringify convert the data in string format
alert(postData);
$.ajax({
       type: "Get",
    url: "action_name?AutoList="+postData,
    data : {
           jgGridData: postData,
        },
    dataType:"json",
    contentType: "application/json; charset=utf-8",
});
JSONArray outerArray = (JSONArray) JSONSerializer.toJSON(AutoList); 
在此in action类之后,将此字符串转换为json格式,如下所示:

var data=jQuery("#gridtable").jqGrid('getRowData');      //this method gets all the data from grid
var postData = JSON.stringify(data);          //using json stringify convert the data in string format
alert(postData);
$.ajax({
       type: "Get",
    url: "action_name?AutoList="+postData,
    data : {
           jgGridData: postData,
        },
    dataType:"json",
    contentType: "application/json; charset=utf-8",
});
JSONArray outerArray = (JSONArray) JSONSerializer.toJSON(AutoList); 

您在jqgrid中使用的格式是什么?json?你应该发布代码,这样人们才能更好地理解你