我有两个JSP页面。 groups.jsp 和 addgroup.jsp
通过单击groups.jsp中的一个按钮,然后单击 AddGroup.jsp.jsp 中的"确定"按钮,可以打开AddGroup JSP页面,我想刷新 groups.jsps.jsps.jsp。怎么可能?
addgroup.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
您可以使用window.opener
objref = window.opener;
返回对打开此当前窗口的窗口的引用。
在您的情况下尝试此操作:
<script type="text/javascript">
function refresh() {
//Refresh page implementation here
window.opener.location.reload();
window.close();
}
</script>
...
...