• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Parent form reload

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 window.open() 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?
reference: https://coderanch.com/t/112989/HTML-JavaScript/refresh-parent-window-child-window
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic