如何从另一个JSP页面刷新此JSP页面?

4
我有两个jsp页面,groups.jspaddGroup.jsp。在groups.jsp中点击一个按钮可以打开addGroup JSP页面,在addGroup.jsp中点击“OK”按钮后,我想刷新groups.jsp。这可能怎么实现呢?
<script type="text/javascript">
   function refresh() {                         
        //Refresh page implementation here
        window.close();
    }
</script>

//some code here
<table>
  <tr>
  <td>
     <h:commandButton id="buttonOK" value="#{common.ok}" type="button" styleClass="button" onclick="submitForm(); refresh();"/>
  <td>
  </tr>
</table>
//some code here
1个回答

4
你可以使用 window.opener

objRef = window.opener;

返回打开当前窗口的窗口的引用。

在你的情况下尝试这个:
<script type="text/javascript">
   function refresh() {                         
        //Refresh page implementation here
        window.opener.location.reload();
        window.close();
    }
</script>
...
...

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接