|
父页面点击提交按钮后,提交的js
function toUpdate(div_id,div_name)
{
var url="<%=path %>/updateSyncAdiv.jsp?flag=view&div_id="+div_id+"&div_name="+div_name;
var returnValue=showModalDialog(url,"windowsss","dialogWidth:500px;dialogHeight:300px;dialogLeft:200px;dialogTop:150px;center:yes;help:yes;resizable:yes;status:yes");
if(returnValue){
//window.location.href="syncConfig.jsp";
window.location.href = window.location.href;
//window.location.reload();
}
如果用showModalDialog()方法,在父页面<head></head>之间加
<base target="_self">
子页面
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@page import="com.foundercy.asset.assetUtil.FileUtil;"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<script language="javascript" type="text/javascript">
function toRunUpdate(){
var div_id = document.getElementById("div_id").value;
var div_name = document.getElementById("div_name").value;
var url="<%=path %>/updateSyncAdiv.jsp?flag=update&div_id="+div_id+"&div_name="+div_name;
// var returnValue=showModalDialog(url,"","");
// if(returnValue){
// window.location.href = window.location.href;
// }
document.form1.action=url;
document.form1.submit();
window.returnValue=true;
window.close();
// window.open('','_top');
// window.top.close();
//parent.window.location.reload();
// window.opener=null;
// window.open("",'_self',""); //新加了一句
// window.close();
}
</script>
</head>
<style type="text/css">
.style3 {font-size: 16px; font-weight: bold; }
.style7 {font-size: 14px}
.style8 {font-size: 14}
</style>
<body>
<%
String div_id = request.getParameter("div_id");
String div_name = request.getParameter("div_name");
String flag = request.getParameter("flag");
if(flag.equals("view"))
{
System.out.println("view update-----------------");
%>
<form id="form1" name="form1" method="post" action="" >
<table width="370" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td height="24" colspan="2" align="center" class="style3">更新同步数据</td>
</tr>
<tr>
<td width="104" class="style8">编号:</td>
<td width="263"><label>
<input type="text" name="div_id" id="div_id" value="<%=div_id %>" size="30" disabled="disabled" />
</label></td>
</tr>
<tr>
<td class="style8">名称:</td>
<td><input type="text" name="div_name" id="div_name" value="<%=div_name %>" size="30"/></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" name="queding" id="queding" value="确定" onclick="toRunUpdate()"/>
<input type="reset" name="chongzhi" id="chongzhi" value="重置" />
<input type="button" name="quxiao" id="quxiao" value="取消" onclick="closeWindows()"/>
</td>
</tr>
</table>
</form>
<%
}
else
{//更新
System.out.println("update-----------------");
FileUtil fileUtil=new FileUtil();
String filePath = fileUtil.getServerConfigFilePath();
fileUtil.updateProperties(filePath,div_id,div_name);
%>
<script>
// dialogArguments.location="syncConfig.jsp";
// window.returnValue=true;
// window.close();
window.open('','_top');
window.top.close();
</script>
<%
}
%>
</body>
<script type="text/javascript" language="javascript">
function closeWindows(){
window.close();
}
</script>
</html> |
|