• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Popup form, parent form

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's one solution:

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:

<html>
<head>
<script type="text/javascript?>
function init() {
opener.location.reload();
close();
}
</script>
</head>
<body on load="init()">
</body>
</html>

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 ]
 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 84
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Merrill,

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.
 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic