The front end transmission parameters, the rear end is acceptable entity class

First, create a parameter to be passed

OP = {} var 

// op.page_id =
op.page_url = window.location.pathname.replace ( "/", "");
op.type = "Delete";
op.description = 'user deletes grid' + ' " 'selRows + [0] .gridName +'" ';

Ajax transfer data type is converted into a string json
data:{userName:'admin',workSpaceId:'403',ids:JSON.stringify(ids),op:JSON.stringify(op)},

后台String接受
the JSONObject deleteGridInfo public (the HttpServletRequest Request, IDS String, String OP ) { 


following conversion to a string
Object p = JSON.parse(op);
Operate as an entity class objects
Operate webCaseInfo = JSONArray.parseObject (p.toString () , Operate.class); // accept data entity class 
above object is cast to an entity class
over

Guess you like

Origin www.cnblogs.com/hjzs/p/11884209.html