Hi, I had a screen(parent) with button 'popup' which opens a popup window(child) which contains the form(input fields) . and the child window contains a button 'Save' on Save 1) submit the child form 2)close the child window 3)refresh the parent window i am using the same Action form for both parent and child and i am opening the child window like this
in action method(popup) im forwarding to popup.jsp and on save(child)
in save action method im forwarding to parent.jsp But it is opening the parent page in popup !!! Please help me with suggestions Thanks
posted 14 years ago
Hmmmm ..i will simplify the explanation How can i submit a popup form(and close) and refresh the parent window at a time when user hits on save button of popup window.
When you submit the form in the popup window, just have it submit normally without any closing of the window or anything else. The action will then execute normally and update whatever information needs to be updated. Then, forward to a page that has nothing but the following:
This method will work only if the scope of your ActionForm is "session". The action submitted by your popup window must put new data in the ActionForm. Then, the refreshed page from the main window will retrieve the ActionForm from the sessino when it's refreshed and show the new data.
The reason you do the "opener.location.reload()" in the forwared-to page is that it doesn't do any good to reload the main page until after the action updating the data has already executed.
P.S. In the above code, substitue "on load" with "onload" [ April 25, 2006: Message edited by: Merrill Higginson ]
My form bean should not be placed in session. because i need the form to be refreshed(Maps to null,strings to null etc) each time user submits data. so for the popup i am passing the data as request paramters. and on the popup im doing something like this.. the popup is closing and the parent is refreshing.
posted 14 years ago
If the main page does not rely on data that is updated when the popup window submits, then this will work fine. If the main page does rely on data updated by the popup window, this will not work.
With this code there is no guarantee that the Action called by the popup submit will finish before the main page is refreshed. In fact, if there are database updates involved, it probably won't. The result will be that the main page will still show the old data instead of the new, or even worsse: sometimes it will and sometimes it won't.
I'll revise my earlier statement about the ActionForm having to be in the session. You can avoid putting the ActionForm in the session as long as the popup Action writes to the database, and as long as the main page reads from the database and rebuilds the ActionForm when it is refreshed.
The important thing here, though, is that you refresh the main page only after the popup page action has completed.
Sorry to reopen this thread after long back. But the case in which facing issue is similar to this topic. That is the reason reopen this thread instead of register new topic.
In my case also, i need to refresh parent window after child window action class executed. As mentioned, I am using the dummy forward JSP. All this steps are working fine if I am closing the child window. As per the requirement, the child window should not be closed. If child window is not closed, the empty child page will be displayed after submit the child window. How to resolve this case.
Hope your suggestion will help to resolve this.
The airline is called "Virgin"? Don't you want a plane to go all the way? This tiny ad will go all the way: