有一个form表单如下:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115<div id="ViewDialog" class="easyui-dialog dialog_twoCol"> <form id="addSfyBuildForm" action="/vpaas_gx/construManage/addConstruManageInfo" method="post" > <div id="DialogTab" class="easyui-tabs"> <div title="基本信息" style="padding: 5px;"> <table class="table02"> <tbody> <tr> <th>项目名称</th> <td colspan="3"><input name="buildProjName" class="entry10 easyui-textbox" type="text" data-options="required: true"></td> </tr> <tr> <th>所处施工阶段</th> <td colspan="3"><input name="buildConsStage" class="entry10 easyui-textbox" type="text"></td> </tr> <tr> <th>所属分公司</th> <td colspan="2"> <input id="dwid1" name="dwid1" class="entry01 easyui-combotree" data-options="height: 30,required:true" > </td> </tr> <tr> <th>总包单位</th> <td colspan="3"><input name="totalUnit" class="entry02 easyui-textbox" type="text"><span class="pdL10"><input type="text" class="entry02 easyui-filebox"></span></td> </tr> <tr> <th>分包商</th> <td colspan="3"><input name="branchUnit" class="entry02 easyui-textbox" type="text"><span class="pdL10"><input type="text" class="entry02 easyui-filebox"></span></td> </tr> <tr class="cloneRow play_none"> <th>分包商</th> <td colspan="3"><input class="entry02 easyui-textbox" type="text"><span class="pdL10"><input type="text" class="entry02 easyui-filebox"></span> <a class="delRow" href="javascript:void(0);">删除</a></td> </tr> <tr> <th></th> <td colspan="3"><a id="AddSubcontractor" href="javascript:void(0);" class="easyui-linkbutton com_btn">添加分包商</a></td> </tr> <tr> <th>监理单位</th> <td colspan="3"><input name="supervisorUnit" class="entry02 easyui-textbox" type="text"><span class="pdL10"><input type="text" class="entry02 easyui-filebox"></span></td> </tr> <tr> <th>施工方<br> 安全负责人</th> <td><input name="consStaff" class="entry02 easyui-textbox" type="text"></td> <th>联系电话</th> <td><input name="consStaffTel" class="entry16 easyui-textbox" type="text"></td> </tr> </tbody> </table> </div> <div title="危险源分析" style="padding: 15px 10px;"> <div id="ToolsHazard" class="clearfix bg_grey_linear"> <a id="OpenAddHazard" href="javascript:void(0);" class="tools_btn bg_ease colL"><span class="btn_add">新增</span></a> <a id="DelHazard" href="javascript:void(0);" class="tools_btn bg_ease colL"><span class="btn_del">删除</span></a> </div> <table id="HazardDG" class="easyui-datagrid"></table> </div> </div> <div class="common_btn dialog-button"> <a id="SaveBuilder" href="javascript:void(0);" class="easyui-linkbutton save_btn">保存</a> <input type="submit" value="保存"> <!-- <a id="EditBuilder" href="javascript:void(0);" class="easyui-linkbutton edit_btn play_none">编辑</a> --> <a onClick="$('#ViewDialog').dialog('close');" href="javascript:void(0);" class="easyui-linkbutton close_btn">关闭</a> </div> </form> </div> <div id="AddHazardDialog" class="easyui-dialog dialog_oneCol"> <div class="boxStyle02"> <form id="AddHazardForm"> <table class="table01"> <tbody> <tr> <th>时间段</th> <td><input class="entry01 easyui-textbox" type="text"></td> </tr> <tr> <th>标题</th> <td><input class="entry01 easyui-textbox" type="text" data-options="height: 60, multiline: true"></td> </tr> <tr> <th>措施</th> <td><input class="entry01 easyui-textbox" type="text" data-options="height: 60, multiline: true"></td> </tr> </tbody> </table> </form> </div> <div class="common_btn dialog-button"> <a id="SaveAddHazard" href="javascript:void(0);" class="easyui-linkbutton save_btn">保存</a> <a onClick="$('#AddHazardDialog').dialog('close');" href="javascript:void(0);" class="easyui-linkbutton close_btn">取消</a> </div> </div> <div id="EditAddHazardDialog" class="easyui-dialog dialog_oneCol"> <div class="boxStyle02"> <form id="AddEditHazardForm"> <table class="table01"> <tbody> <tr> <th>时间段</th> <td><input class="entry01 easyui-textbox" type="text"></td> </tr> <tr> <th>标题</th> <td><input class="entry01 easyui-textbox" type="text" data-options="height: 60, multiline: true"></td> </tr> <tr> <th>措施</th> <td><input class="entry01 easyui-textbox" type="text" data-options="height: 60, multiline: true"></td> </tr> </tbody> </table> </form> </div>
想把表中的数据全部提交到后台,不用自己序列化,有一种方法如下,在js中写:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33$('#DevEquipmentForm').form('submit', { //url : saveOrgUrl, onSubmit : function() { var isValid = $(this).form('validate'); if (!isValid) { } return isValid; // return false will stop the form submission }, success : function(datas) {// 返回的是组织id var data = eval("("+datas+")"); if (data.success) { $('#ViewDialog').dialog('close'); $.messager.show({ title : '保存成功', msg : '保存设备成功.', timeout : 3000, showType : 'slide' }); $("#BuilderDg").datagrid('reload'); } else { var msg = "保存设备失败."; msg = data.message; $.messager.show({ title : '保存失败', msg : msg, timeout : 3000, showType : 'slide' }); } } });
这样,可以把表单中所有内容提交,同时要注意,表单中要提交的数据加name属性,name的名称要和实体类名称一致,这样就可以在后台直接写一个
对象作为参数,如下:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12</pre><pre name="code" class="java">@RequestMapping(value = "/addConstruManageInfo") @ResponseBody public String addConstruManageInfo(SfyBuild sfyBuild){ sfyConstruManageService.insert(sfyBuild); System.out.println("==========sfyBuild:"+JSONObject.fromObject(sfyBuild).toString()); // sfyConstruManageService.insert(sfyBuild); return ""; }
最后
以上就是紧张白开水最近收集整理的关于from表单中action有地址,向后台提交参数的相关问题的全部内容,更多相关from表单中action有地址,向后台提交参数内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复