1、js代码:
var workData = []; // 添加元素 workData.push({'pk':'1','name':'1x'}); workData.push({'pk':'2','name':'2x'}); workData.push({'pk':'3','name':'3x'}); workData.push({'pk':'4','name':'4x'}); $.post('/hospital1/entry/poActions.jsp', { mode:'saveWork', 'workData':JSON.stringify(workData) });
2、java代码:
List<Map<String,String>> list = gson.fromJson(request.getParameter("workData"), new TypeToken<List<Map<String,String>>>(){}.getType()); for(Map<String,String> map : list){ System.out.print("pk:"+map.get("pk")); System.out.println("\tname"+map.get("name")); }
时间: 2024-12-06 15:10:07