一、设备主页面(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;//获取弹出层的iframe
saveParam();//自定义保存数据方法
$("#"+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")
@ResponseBody
public 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;
}

JEECG弹出框提交表单的更多相关文章

  1. vue iview modal弹出框 form表单验证

    一.ref="addApply" :model="addApply" :rules="ruleValidate"   不要忘记prop 二. ...

  2. jeecg 弹出框 点击按钮回调父页面 返回值

    jeecg 弹出框 点击按钮回调父页面 返回值 <t:base type="jquery"></t:base> <t:base type=" ...

  3. iframe中使用模态框提交表单后,iframe加载父页面的解决方法

    在iframe中使用模态框提交表单后,会出现iframe加载整个父页面的问题,如下图: 解决方法: 在form表单中添加target属性 _parent 这个属性会使目标文档载入父窗口或者包含来超链接 ...

  4. Layui 监听 复选框 提交表单

    表单数据这一块 layui 做的是真的不好,无论是在渲染还是在交互方面,每次都要自己来重新实现代码 #贴上代码 <!DOCTYPE html> <head> <meta ...

  5. EasyUI加zTree使用解析 easyui修改操作的表单回显方法 验证框提交表单前验证 datagrid的load方法

    带参提交一次查询,从服务器加载新数据.这是一个神奇的方法 $('#dg').datagrid('load',{ code: '01', name: 'name01' }); easyui修改操作的回显 ...

  6. ios手机弹出层上表单的操作,收起键盘焦点错乱的问题

    今天遇到了ios手机下 弹出层上form表单 当收起键盘后,焦点错乱,无法再操作的问题 解决办法 function device() { const u = navigator.userAgent; ...

  7. easyUI使用dailog实现弹出框带表单功能

    本文为博主原创,未经允许不得转载: 示例如下: 需要注意的地方在id为win的div中需要有:closed="true"这个属性,这个属性为控制dailogn对话框显示与隐藏的属性 ...

  8. 由于想要实现下载的文件可以进行选择,而不是通过<a>标签写死下载文件的参数,所以一直想要使用JFinal结合ajax实现文件下载,但是ajax实现的文件下载并不能触发浏览器的下载文件弹出框,这里通过模拟表单提交实现同样的效果。

    由于想要实现下载的文件可以进行选择,而不是通过<a>标签写死下载文件的参数,所以一直想要使用JFinal结合ajax实现文件下载(这样的话ajax可以传递不同的参数),但是ajax实现的文 ...

  9. Bootstrap使用模态框modal实现表单提交弹出框

    Bootstrap 模态框(Modal)插件 模态框(Modal)是覆盖在父窗体上的子窗体.通常,目的是显示来自一个单独的源的内容,可以在不离开父窗体的情况下有一些互动.子窗体可提供信息.交互等.如果 ...

随机推荐

  1. String.format()的用法记录

    stirng.format("redirect:http://%s:%s%s",ip,port,path) 相当于http://localhost:8080/user/list S ...

  2. 如何在本地远程连接linux虚拟机上面的mysql

    基础环境: 在linux安装mysql 检查远程的虚拟机是否可以ping通过 查看虚拟机IP为192.168.38.128 cmd窗口ping 192.168.38.128,出现如下界面说明是可以的 ...

  3. 使用yaml格式进行接口测试报错

    前言:本人公司使用yaml做接口测试.某日开发写了一个字典嵌套列表,列表里面再嵌套字典的接口. yaml的值应该为下图(注意缩进问题)   加了-代表下面是一个列表 {'uid': '3a61479f ...

  4. 《深入理解Java虚拟机》读书笔记十二

    第十二章  Java内存模型与线程 1.硬件效率与一致性 由于计算机的存储设备与处理器的运算速度有几个数量级的差距,所以现代计算机系统都不得不加入一层读写速度尽可能接近处理器运算速度的高速缓存(Cac ...

  5. MyEclipse 安装及激活教程

    一.下载安装MyEclipse 在进行下面的步骤之前,先安装好MyEclipse (10.0.2015版本或更高版本)和JDK,安装完成后暂时不要运行MyEclipse. 二.运行MyEclipse激 ...

  6. python3爬取百度知道的问答并存入数据库(MySQL)

    一.链接分析: 以"Linux"为搜索的关键字为例: 首页的链接为:https://zhidao.baidu.com/search?lm=0&rn=10&pn=0& ...

  7. ServletContext总结(转)

    今天我们学习的是ServletContext的应用. WEB容器在启动时,它会为每个WEB应用程序都创建一个对应的ServletContext对象,它代表当前web应用. ServletConfig对 ...

  8. Apache Kafka(三)- Kakfa CLI 使用

    1. Topics CLI 1.1  首先启动 zookeeper 与 kafka > zookeeper-server-start.sh config/zookeeper.properties ...

  9. MongoDB 在Windows环境的下载、安装、配置

    MongoDB4.0在Windows环境的下载.安装.配置 今天本想玩玩MongoDB,可因工作机上未下载Linux虚拟机,下载多耗时.无奈只能先下载Windows版本耍耍.不料,Windows在安装 ...

  10. springMVC 校验时,CustomValidationMessages.properties中的错误提示信息的中文乱码 问题

    今天在学习springmvc的校验时,遇到了CustomValidationMessages.properties配置文件的信息,才错误提示时是乱码的问题:在网上找了很多方法都没解决:最后原来是在配置 ...