Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parent form reload

 
Nisha Joseph
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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: http://www.coderanch.com/t/112989/HTML-JavaScript/refresh-parent-window-child-window
 
Sol Mayer-Orn
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 ]
 
Pavan Kumar
Greenhorn
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic