我正在使用js网格(http://js-grid.com/docs/),当用户单击“提交”按钮时,我想获取所有js-grid内容,如下所示:
<link type="text/css" rel="stylesheet" href="jsgrid.min.css" />
<link type="text/css" rel="stylesheet" href="jsgrid-theme.min.css" />
<script type="text/javascript" src="jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="jsgrid.min.js"></script>
<form name="form1" method="post" action="MyJavaBackend">
<div id="jsGrid"></div>
<Input type="submit">
</form>
<script>
var clients = [
{ "Name": "Otto Clay", "Age": 25, "Country": 1, "Address": "Ap #897-1459 Quam Avenue", "Married": false },
];
var countries = [
{ Name: "", Id: 0 },
{ Name: "United States", Id: 1 },
{ Name: "Canada", Id: 2 },
{ Name: "United Kingdom", Id: 3 }
];
$("#jsGrid").jsGrid({
width: "100%",
height: "400px",
inserting: true,
editing: true,
sorting: true,
paging: true,
data: clients,
fields: [
{ name: "Name", type: "text", width: 150, validate: "required" },
{ name: "Age", type: "number", width: 50 },
{ name: "Address", type: "text", width: 200 },
{ name: "Country", type: "select", items: countries, valueField: "Id", textField: "Name" },
{ name: "Married", type: "checkbox", title: "Is Married", sorting: false },
{ type: "control" }
]
});
</script>
但是我的后端文件:
public ActionForward create(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
String[] datas = request.getParameterValues("data");// **get null**
return mapping.findForward("create");
}
我已经检查了以下文章:http: //zetcode.com/articles/jsgridservlet/
但是它只能得到一行编辑过的记录。(我要获取所有表数据)
在用户通过request.getParameterValues或request.getParameter或.....单击提交按钮后,如何从jsgrid获取所有数据(所有用户输入)?
慕斯王
相关分类