2013-08-04 20 views
-1

得到JSON名單這是我的動作類:如何編寫Action類,從的jqGrid

private List<Employee> postData; // corresponding getter and setter 

public String getJson() 
     { 

    System.out.print("Sahi hai"); 
    System.out.print("postData =="+postData); 

    return ActionSupport.SUCCESS; 


     } 

我已經做支柱映射也。

+0

我的JSON數據是[{ 「的itemId」: 「mcw750」, 「currentQty」: 「90」, 「saleQty」: 「2」,」 unitPrice「:」100「,」salePrice「:」200「}] – Pankaj

+0

不清楚你問什麼,從jqgrid或jqgrid? –

+0

我發送數據從jqgrid到服務器.. – Pankaj

回答

0

由於您在發送之前使用stringify,因此您必須在操作中將「postData」聲明爲字符串。

String postData; //with getters n setters 

public String getJson() 
    {  
System.out.print("postData =="+getPostData()); 

return ActionSupport.SUCCESS; 


    } 

和AJAX得到的數據作爲

data :{"postData":data} 
+0

如果他們使用的是json插件,則不需要。 –