最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to refresh a jsp page from another jsp page? - Stack Overflow

programmeradmin0浏览0评论

I have two jsp pages. groups.jsp and addGroup.jsp

The addGroup JSP page is opened by clicking a button in groups.jsp and after clicking the "OK" button in addGroup.jsp, I'd like to refresh the groups.jsp. How will that be possible?

addGroup.jsp

<script type="text/javascript">
   function refresh() {                         
        //Refresh page implementation here
        window.close();
    }
</script>

//some code here
<table>
  <tr>
  <td>
     <h:mandButton id="buttonOK" value="#{mon.ok}" type="button" styleClass="button" onclick="submitForm(); refresh();"/>
  <td>
  </tr>
</table>
//some code here

I have two jsp pages. groups.jsp and addGroup.jsp

The addGroup JSP page is opened by clicking a button in groups.jsp and after clicking the "OK" button in addGroup.jsp, I'd like to refresh the groups.jsp. How will that be possible?

addGroup.jsp

<script type="text/javascript">
   function refresh() {                         
        //Refresh page implementation here
        window.close();
    }
</script>

//some code here
<table>
  <tr>
  <td>
     <h:mandButton id="buttonOK" value="#{mon.ok}" type="button" styleClass="button" onclick="submitForm(); refresh();"/>
  <td>
  </tr>
</table>
//some code here
Share Improve this question asked Mar 14, 2017 at 3:43 JuniorJunior 1475 silver badges14 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

You can use window.opener

objRef = window.opener;

Returns a reference to the window that opened this current window.

Try this in your case:

<script type="text/javascript">
   function refresh() {                         
        //Refresh page implementation here
        window.opener.location.reload();
        window.close();
    }
</script>
...
...
发布评论

评论列表(0)

  1. 暂无评论