简体   繁体   中英

How to refresh a jsp page from another jsp page?

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:commandButton id="buttonOK" value="#{common.ok}" type="button" styleClass="button" onclick="submitForm(); refresh();"/>
  <td>
  </tr>
</table>
//some code here

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>
...
...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM