获取修改的记录,修改后按确定后触发editUser():
function editUser(){
var row = $('#dg').datagrid('getSelected');
if (row){
$('#bian').dialog('open').dialog('setTitle','编辑账户');
$('#bianji').form('load',row);
url = 'update_user.php?id='+row.id;
}
}
它对应的div是:<div id="bian" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px "
closed="true" buttons="#dlg-buttons">
<div class="ftitle">编辑信息</div>
<form id="bianji" method="post" novalidate>
<div class="fitem">
<label>http服务接口名称</label>
<input name="httpServiceName" class="easyui-validatebox" required="true">
</div>
<div class="fitem">
<label>http服务请求类型</label>
<input name="httpRequestType" class="easyui-validatebox" required="true">
</div>
<div class="fitem">
<label>http 服务响应类型</label>
<input name="httpResponseType" class="easyui-validatebox" required="true">
</div>
<div class="fitem">
<label>http开始时间</label>
<input name="httpStartDateTime" class="easyui-validatebox" required="true">
</div>
<div class="fitem">
<label>http断开时间</label>
<input name="httpEndDateTime" class="easyui-validatebox" required="true">
</div>
<div class="fitem">
<label>http连接时长</label>
<input name="httpConnctionTime" class="easyui-validatebox" required="true">
</div>
<div class="fitem">
<label>http执行是否成功</label>
<input name="httpStatus" class="easyui-validatebox" required="true">
</div>
<div class="fitem">
<label>http连接描述</label>
<input name="httpConnctionDesc" class="easyui-validatebox" required="true">
</div>
<div id="dlg-buttons">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="saveuser()" iconcls="icon-save">保存</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:$('#bian').dialog('close')"
iconcls="icon-cancel">取消</a>
</div>
</form>
</div>
单击保存后触发saveuser()方法:
function saveuser(){
var result;
$('#bianji').form('submit',{
url: '<%=path%>/httpLog/getHttpLogData.do',
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
result = eval('('+result+')');
}
});
$('#dg').datagrid({
columns:[[
{field:'result.httpServiceName',title:'http服务接口名称',width:60},
{field:'result.httpRequestType',title:'http服务请求类型',width:60},
{field:'result.httpResponseType',title:'http 服务响应类型',width:60},
{field:'result.httpStartDateTime',title:'http开始时间',width:60},
{field:'result.httpEndDateTime',title:'http断开时间',width:60},
{field:'result.httpConnctionTime',title:'http连接时长',width:60},
{field:'result.httpStatus',title:'http执行是否成功',width:60},
{field:'result.httpConnctionDesc',title:'http连接描述',width:60},
]]
});
后台对应的方法是:@RequestMapping("/getHttpLogData")
private void getHttpLogData(HttpServletResponse response,HttpServletRequest request)
throws IOException {
String httpServiceName=request.getParameter("httpServiceName");
String httpRequestType=request.getParameter("httpRequestType");
String httpResponseType=request.getParameter("httpResponseType");
String httpStartDateTime=request.getParameter("httpStartDateTime");
String httpEndDateTime=request.getParameter("httpEndDateTime");
String httpConnctionTime=request.getParameter("httpConnctionTime");
String httpStatus=request.getParameter("httpStatus");
String httpConnctionDesc=request.getParameter("httpConnctionDesc");
JSONObject jsonObject = new JSONObject();
JSONArray rows = new JSONArray();
Map<String, String> map = new HashMap<String, String>();
map.put("httpServiceName", httpServiceName);
map.put("httpRequestType",httpRequestType);
map.put("httpResponseType",httpResponseType);
map.put("httpStartDateTime",httpStartDateTime);
map.put("httpEndDateTime", httpEndDateTime);
map.put("httpConnctionTime",httpConnctionTime);
map.put("httpStatus", httpStatus);
map.put("httpConnctionDesc", httpConnctionDesc);
response.setCharacterEncoding("utf-8");
response.setHeader("Cache-Control", "no-cache");
response.setContentType("text/json;charset=UTF-8");
jsonObject.put("total", 1);
jsonObject.put("rows", rows);
System.out.println(jsonObject.toString());
response.getWriter().write(jsonObject.toString());
求大师帮忙!!!!!
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。