主窗体main.jsp 有js如下
function a(){  window.showModalDialog('open.jsp',window,'resizable:yes;scroll:yes;status:no;dialogWidth=600px;dialogHeight=600px;center=yes;help=no');}open.jsp 大概内容如下<script language="JavaScript"> 
function testFun()(){
       document.forms[0].submit();   
}          //提交数据
</script><body>
   <form name="exp" action="test.action" method="post" target="_self" >  
<table width="500" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6633FF">
  <tr align="center" bgcolor="#FFFFFF">
    <td colspan="2">姓名</td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td width="109" align="left">名称:</td>
    <td width="384" align="left"><input type="text" id= "voBean.dbSourceName" name="voBean.dbSourceName" size="20" ></input></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td align="left">年龄:</td>
    <td align="left"><input type="text" id= "voBean.description" name="voBean.description" size="20" ></td>
  </tr>
  <tr align="center" bgcolor="#FFFFFF">
    <td colspan="2"> 
       <input type="button" name="btnExp" value="确定" onClick="testFun();"></input>
             
            </td>
  </tr>
</table>
  </form>   
</body>
</html>action配置如下:
<action name="test" class="com.test.TestAction" method="doAdd">
</action>是想要open.jsp提交到Acton后,插入数据,然后把open.jsp弹出窗口关闭,并刷新main.jsp的内容,
但现在open.jsp窗口关闭不了,也不能刷新main.jsp的内容.而是在open.jsp出现一个新的页面?
请问要怎么做????

解决方案 »

  1.   

    你action 写错了,得写个跳转啊。还有你得赋值才能显示啊。
      

  2.   

    open.jsp加入
    <%
    String success1 = (String)request.getAttribute("success1");
    if(success1 != null){
    %>
    alert('<%=success1%>');
    window.returnValue = 1;
    window.close();
    <%
    }
    %>main.jsp 
    function a(){ var flag =  window.showModalDialog('open.jsp',window,'resizable:yes;scroll:yes;status:no;dialogWidth=600px;dialogHeight=600px;center=yes;help=no');
    if(flag == 1){
    document.location.href = document.location.href;
    }
    }
      

  3.   

    请问tubage408
    success1是在Action里设一个属性吗?
    然后在<action name="test" class="com.test.TestAction" method="doAdd">
    </action>
    要配跳转吗?
      

  4.   

    原来弹出页面是关闭了,但由于是struts2的Action有一个跳转,
    又出现一个空白的页面,高手们,怎么回事啊?
      

  5.   

    设计到的是一个JS中的页面传值问题
    function show(){
    var res;
    res = window.showModalDialog("demo2.html","","dialogWidth=400px;dialogHeight=200px");
    if(res!=null){
    document.getElementById("hobby").value=res;
    }
    }
    if(res=="ok")
    {
    window.open=null;
    window.close();
    }