我有两个 jsp 页面。 groups.jsp 和addGroup.jsp
通过单击 groups.jsp 中的按钮打开 addGroup JSP 页面,单击 addGroup.jsp 中的“确定”按钮后,我想刷新 groups.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;
Returns a reference to the window that opened this current window.
在你的情况下试试这个:
<script type="text/javascript">
function refresh() {
//Refresh page implementation here
window.opener.location.reload();
window.close();
}
</script>
...
...
关于javascript - 如何从另一个jsp页面刷新一个jsp页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42777401/