jsp function方法中,怎么可以关闭当前jsp页面

怎么实现在在父页面的子页面上点击保存的时候会关闭当前子页面页面,再刷新父页面


<script>
 function refreshParent() {
  window.opener.location.href = window.opener.location.href;
  window.close();  
 }      
<input type="button" οnclick="refreshParent()" />

window.top.location.href = url;