File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Parent form reload Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Parent form reload" Watch "Parent form reload" New topic

Parent form reload

Nisha Joseph

Joined: Feb 23, 2007
Posts: 1
I'm looking to have a popup window do a submit,then close the window and reload the parent. I have seen the solution in this site as using to open popup and then in that popup use window.opener.location.reload().
This is working.

But the problem is my parent window is calling a servlet on submit. So it is showing Messagebox "Information need to resend.. retry cancel"
How can I avoid this? In this forum itself I saw one solution as using a dummy form in parent and reloading. But that is giving nullpointer exception as my servlet requires some parameters. Can someone help?
Sol Mayer-Orn
Ranch Hand

Joined: Nov 13, 2002
Posts: 311
Personally, I usually manage to make it work with the 'submit form' approach. Admittedly, it might require some work.

For *some* cases, there are easy 'shortcuts':
1) If the servlet can guess 'default values' for missing parameters.
2) If the parent page already happens to include the (non-dummy) form which generated it in the first place (like 'Google' - you submit a form, and in reply you get the same form again, plus results underneath).
Then you can submit this form (provided it doesn't perform 'database write').

For more general cases, you *can* use a "dummy form", just add some *hidden parameters*.
Basically, when the servlet(or jsp) first writes the parent page, it can print a dummy form, which would preserve the original request parameters (as hidden params).
Example - assuming your param is called 'myParam' :

Now, when you decide to submit the dummy form (through javascript), it will carry the same parameter as the original request.

Hope this helps
[ February 27, 2007: Message edited by: Sol Mam-Orn ]
Pavan Kumar

Joined: Jun 08, 2005
Posts: 23
You can infact call a function in the parent page using the
opener.document.Script.reloadPage(); from the popup page.. Here reloadPage() is a JavaScript function in the Parent page. You can resubmit you form in your JavaScript Function or just refresh values which you want.

Hope this helps.
I agree. Here's the link:
subject: Parent form reload
It's not a secret anymore!