Window A displays a list of objects, and window B is the detail page for an object that the user selects. The user is able to edit the detail page and to save his changes. When the user clicks save, I want window B to close and window A to refresh.
...but it appears that doing so prevents the action from being called, so the detail page doesn't save.
In my project, we use the second approach mentioned by Merrill ("have the action forward to a page that does nothing but close the window in the onload method of the <body> tag"). This also give you the ability to display validation error messages on the popup window.
posted 14 years ago
I just thought of something else on this problem: If the action for Window B puts something in the HttpSession, and you're expecting the document in Window A to show that change when it's refreshed, you probably want to use the second method of closing the window, and also refresh Window A from the forwarded-to JSP, rather than from the submitting JSP.
If you do it this way, you are assured that the action that puts something in the session has completed before Window A gets refreshed. Otherwise, you have no guarantees that Window A will show the new data when it gets refreshed.
so, you'd have something like this
<body on load="opener.location.reload(true);window.close()">