框架中jsp弹出js后提交表单时执行action时没有跳转回原jsp,而是在打开了另外一个页面,我想让它跳回原jsp 框架中jsp弹出js后提交表单时执行action时没有跳转回原jsp,而是在打开了另外一个页面,我想让它跳回原jsp。人事管理中后台,框架右边显示员工所有信息,点上面添加员工 ,弹出一个子页面,填写信息 点提交 执行Action但是跳转是打开新的查询所有员工信息页面,应该是关闭该子页面,并且回到原框架父页面。这样跳转才是对,如何解决 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你在子页面点提交后,执行一个window.close("页面");就可以关闭子页面。后台action执行好以后,返回到父页面就行了 后台action执行好以后,返回到父页面就行了,是返回不到父页面的。是新打开一个页面,并不是框架后台一层的父页面 实在不行可以用div遮住后面的内容不弹出新窗口,弹出一个div<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>测试首页</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <script src="temp/jquery-1.3.2.js" type="text/javascript" language="javascript"></script> <style type="text/css"> a{color:blue;} #divBgReg{ background:#FFFFFF none repeat scroll 0 0; height:100%; left:0; top:0; width:100%; filter:alpha(opacity=80);/* IE */ -moz-opactiy:0.8; /* Moz + FF */ z-index=:10000; } #divReg{ width:326px; height:306px; margin:-200px 0 0 -200px; left:50%; top:50%; position:absolute; background:#FFF; z-index:10001; border:3px solid #1B5BAC; } #divClose{ text-align:right; background:D4D0C8; right:10px; top:10px; width:100%; height:20px; overflow:hidden; cursor:pointer; } </style> <script type="text/javascript"> function myReg(){ $("#divReg").show(); $("#divBgReg").show(); } function closeReg(){ $("#divReg").hide() $("#divBgReg").hide(); } function checkReg(myForm){ if(!checkNull(myForm)){ return false; } if(myForm.Rpass.value==null || myForm.Rpass.value==""){ alert("重复密码不能为空"); myForm.Rpass.focus(); return false; } if(myForm.Rpass.value!=myForm.userpass.value){ alert("重复密码与密码不一致"); return false; } return true; } function checkNull(myForm){ if(myForm.username.value==null || myForm.username.value==""){ alert("用户名不能为空"); myForm.username.focus(); return false; } if(myForm.userpass.value==null || myForm.userpass.value==""){ alert("密码不能为空"); myForm.userpass.focus(); return false; } return true; } function check(){ var sel = document.getElementById("abc"); for(var i=0 ;i<sel.options.length;i++){ if(sel.options[i].value==3){ sel.options[i].selected=true; } } } </script> </head> <body style="text-align:center;"> <div id="divReg" style="display:none;"> <div id="divClose"><a href="#" onclick="closeReg()">关闭</a></div> <div id="divRegContent" style="align:center;"> <form name="regForm" action="" onsubmit="return checkReg(this)" method="post"> <table style="height:200;width:250;" > <thead> <th colspan="2"></th> </thead> <tr> <td width="30%">用户名</td> <td width="70%"><input type="text" name="username"/></td> </tr> <tr> <td width="30%">密 码</td> <td width="70%"><input name="userpass" type="password"/></td> </tr> <tr> <td width="30%">重复密码</td> <td width="70%"><input name="Rpass" type="password"/></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value=" 注 册 "></td> </tr> </table> </form> </div> </div> <div id="divBgReg" style="position:absolute;display:none;"></div> 这个是首页<br> <form action="" name="loginForm" onsubmit="return checkNull(this)" method="post"> 用户名:<input type="text" name="username" /><br><br> 密 码:<input type="password" name="userpass" /><br><br> <input type="submit" value=" 登 录 " /> <input type="button" value=" 注 册 " onclick="myReg()" /> </form> </body></html> 子页面js代码可以这么写if(opener) opener.document.form.submit(); window.close();这样子窗口关闭的同时 父窗口会对你所增加的信息进行再次刷新。显示你要增加的信息 父窗口可以用一个隐藏表单域 来向action传值 处理里面刷新<form name="form1" action="??"><s:hidden name="??" ></s:hidden></form> websphere 加载不到native library 只进 ResultSet 不支持请求的操作。 怎么提高数据传输的效率? <error> local 是什么意思 问个spring的简单问题 struts如何实现动态添加文本框? js 禁止子窗口的操作 求大神指教 用J2EE编什么?举个例子 ms的jdbc驱动怎么调用sql server存储过程? Software caused connection abort: socket write error drools规则引擎问题 求推荐ajax学习视频
不弹出新窗口,弹出一个div<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>测试首页</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page"> <script src="temp/jquery-1.3.2.js" type="text/javascript" language="javascript"></script>
<style type="text/css">
a{color:blue;}
#divBgReg{
background:#FFFFFF none repeat scroll 0 0;
height:100%;
left:0;
top:0;
width:100%;
filter:alpha(opacity=80);/* IE */
-moz-opactiy:0.8; /* Moz + FF */
z-index=:10000;
}
#divReg{
width:326px;
height:306px;
margin:-200px 0 0 -200px;
left:50%;
top:50%;
position:absolute;
background:#FFF;
z-index:10001;
border:3px solid #1B5BAC;
}
#divClose{
text-align:right;
background:D4D0C8;
right:10px;
top:10px;
width:100%;
height:20px;
overflow:hidden;
cursor:pointer;
}
</style>
<script type="text/javascript">
function myReg(){
$("#divReg").show();
$("#divBgReg").show();
}
function closeReg(){
$("#divReg").hide()
$("#divBgReg").hide();
}
function checkReg(myForm){
if(!checkNull(myForm)){
return false;
}
if(myForm.Rpass.value==null || myForm.Rpass.value==""){
alert("重复密码不能为空");
myForm.Rpass.focus();
return false;
}
if(myForm.Rpass.value!=myForm.userpass.value){
alert("重复密码与密码不一致");
return false;
}
return true;
}
function checkNull(myForm){
if(myForm.username.value==null || myForm.username.value==""){
alert("用户名不能为空");
myForm.username.focus();
return false;
}
if(myForm.userpass.value==null || myForm.userpass.value==""){
alert("密码不能为空");
myForm.userpass.focus();
return false;
}
return true;
}
function check(){
var sel = document.getElementById("abc");
for(var i=0 ;i<sel.options.length;i++){
if(sel.options[i].value==3){
sel.options[i].selected=true;
}
}
}
</script>
</head>
<body style="text-align:center;">
<div id="divReg" style="display:none;">
<div id="divClose"><a href="#" onclick="closeReg()">关闭</a></div>
<div id="divRegContent" style="align:center;">
<form name="regForm" action="" onsubmit="return checkReg(this)" method="post">
<table style="height:200;width:250;" >
<thead>
<th colspan="2"></th>
</thead>
<tr>
<td width="30%">用户名</td>
<td width="70%"><input type="text" name="username"/></td>
</tr>
<tr>
<td width="30%">密 码</td>
<td width="70%"><input name="userpass" type="password"/></td>
</tr>
<tr>
<td width="30%">重复密码</td>
<td width="70%"><input name="Rpass" type="password"/></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value=" 注 册 "></td>
</tr>
</table>
</form>
</div>
</div>
<div id="divBgReg" style="position:absolute;display:none;"></div>
这个是首页<br>
<form action="" name="loginForm" onsubmit="return checkNull(this)" method="post">
用户名:<input type="text" name="username" /><br><br>
密 码:<input type="password" name="userpass" /><br><br>
<input type="submit" value=" 登 录 " /> <input type="button" value=" 注 册 " onclick="myReg()" />
</form>
</body>
</html>
if(opener)
opener.document.form.submit();
window.close();
这样子窗口关闭的同时 父窗口会对你所增加的信息进行再次刷新。显示你要增加的信息
父窗口可以用一个隐藏表单域 来向action传值 处理里面刷新
<form name="form1" action="??">
<s:hidden name="??" ></s:hidden>
</form>