JEECG弹出框提交表单
生活随笔
收集整理的這篇文章主要介紹了
JEECG弹出框提交表单
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一、設備主頁面(deviceMain.jsp)
<t:dgToolBar title="編輯設備" icon="icon-edit" url="deviceController.do?goDeviceDetail" funname="editMyDevice"></t:dgToolBar> // 編輯管理的設備 function editMyDevice(title,url,gname){var ids = ""; var rows = $("#" + gname).datagrid('getSelections');if (rows.length == 1) {$.dialog.setting.zIndex = getzIndex(true);$.dialog.confirm('你確定編輯該數據嗎?', function(r) {if (r) {$.dialog({ content: 'url:'+url+"&ids="+rows[0].serial, lock : true, width:700, height:320, title:"編輯設備信息", opacity : 0.3, cache:false,cancelVal: '關閉', cancel: true, /*為true等價于function(){}*/ button:[{name: '保存', callback: function(){iframe = this.iframe.contentWindow;//獲取彈出層的iframesaveParam();//自定義保存數據方法$("#"+gname).datagrid("reload");$("#"+gname).datagrid('unselectAll');return true;//阻止頁面關閉(默認為true不關閉) }}]});}});} else if (rows.length > 1) {tip("請選擇一條數據進行編輯");} else {tip("請選擇需要編輯的數據");} }/*** 自定義保存數據方法* @param url* @param gridname*/ function saveParam() {$("#formobj", iframe.document).form('submit', {onSubmit : function() {},success : function(r) {msgdialog('操作成功!','success');},error : function(r) {msgdialog('操作異常!','error');}});//UsersForm為Form表單id,提交表單 }/*** 操作結果提示語* @param content:提示內容* @param type:圖標類型*/ function msgdialog(content,type){$.dialog({content: content,title:'提示信息',icon: type+'.gif',titleIcon: 'lhgcore.gif',width:136,height:80,top: '98%',left:'98%',fixed: true}); }?
二、設備彈出框編輯頁面(deviceEdit.jsp)
<body style="overflow-y: hidden" scroll="no"> <t:formvalid formid="formobj" layout="table" dialog="true" action="deviceController.do?doUpdateDevice"><input id="serial" name="serial" type="hidden" value="${device.serial}"><input id="phone" name="phone" type="hidden" value="${device.phone }"><input id="smsflag" name="smsflag" type="hidden" value="${device.smsflag }"><table style="width: 600px;" cellpadding="0" cellspacing="1" class="formtable"><tr><td align="right" width="25%" nowrap><label class="Validform_label"> IP: </label></td><td class="value" width="85%"><input id="nodeip" name="nodeip" class="inputxt" type="text" datatype="s1-200" value="${device.nodeip}"/><span class="Validform_checktip"></span></td></tr><tr><td align="right"><label class="Validform_label"> 主機名稱: </label></td><td class="value"><input id="hostname" name="hostname" class="inputxt" type="text" value="${device.hostname}"/></td></tr><tr><td align="right"><label class="Validform_label"> 類型: </label></td><td class="value"><input id="type" name="type" class="inputxt" type="text" value="${device.type}"/></td></tr></table> </t:formvalid> </body>?
三、后臺程序(DeviceController.java)
/*** 進入編輯頁面* @param id* @param request* @return*/@RequestMapping(params="goDeviceDetail")public String goDeviceDetail(String ids, HttpServletRequest request) {String sql = "select * from device where Serial = " + ids;Device device= deviceService.excuteQuery(sql);device.setNodeip(device.getNodeip().trim());device.setHostname(device.getHostname().trim());device.setPhone(device.getPhone().trim());device.setType(device.getType().trim());device.setSmsflag(device.getSmsflag().trim());request.setAttribute("device", device);return "device/deviceEdit";} /*** 更新設備信息* * @return*/@RequestMapping(params = "doUpdateDevice")@ResponseBodypublic AjaxJson doUpdateDevice(Device device, HttpServletRequest request) {String message = "更新設備成功";AjaxJson j = new AjaxJson();String nodeip = device.getNodeip().trim();String hostname = device.getHostname().trim();String type = device.getType().trim();String updateSybaseSql = "update device set NodeIP='" + nodeip + "', hostname='"+hostname+"', type='"+type+"' where Serial=" + device.getSerial();int result = this.deviceService.excuteUpdate(updateSybaseSql);if(result != -1){this.systemService.saveOrUpdate(device);try {DataSyncQueue.syncPhoneZrQueue.put("phone_zr"); //更新設備信息成功后,同步數據} catch (InterruptedException e) {e.printStackTrace();}} j.setMsg(message);return j;}?
轉載于:https://www.cnblogs.com/xiehongwei/p/7776871.html
總結
以上是生活随笔為你收集整理的JEECG弹出框提交表单的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 101PPT游戏化换肤遇到的问题
- 下一篇: git问题一箩筐: