This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
Joined: Feb 15, 2005
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()">
Joined: Jan 25, 2006
Thanks for your replies. Calling the opener.location.reload from the Window B JSP (as part of an onlick event for the save button) appears to refresh Window A with the updated information as desired.