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 Refreshing parent window 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 "Refreshing parent window " Watch "Refreshing parent window " New topic

Refreshing parent window

Sathwik Raju

Joined: Jun 02, 2005
Posts: 4

I am working on a web application where I am using parent/child windows. My application has one main window and some buttons like for adding new record, modifying new record etc. When user clicks on any button a child window opens where user enters data and upon clicking save/update button there, the page gets submitted within the child window giving him message whether save/update is successful or not. Now when he closes the child window I would like to refresh the parent window which maintains list of added records. Note that child window is not a modal window and resubmission of page is happening within the window.

I could achieve this if the child window is a modal window and if there is no resubmission of the page within the child window.
In body I am calling this function on unload

function refreshParent()

var xWin=window.dialogArguments;

In a nutshell I would like achieve this

1. Open non-modal child window with some fields for user to enter, when any button is clicked in parent window
2. Page should get submitted within the child window upon clicking save/update button showing some message
3. Upon closing child window the parent window should get refreshed.

Can anyone help me out.

Thanks in advance

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

This is really more of an HTML question than a JSP one.

You can use window.opener to get a handle on the main browser instance.
'Parent" is a term used in a frame/frameset relationship.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Murali Banda

Joined: Jun 22, 2005
Posts: 1
some web sites suggest this code:
window.opener.document.reload(), but I couldnt get it to work.

However, the following code works:
window.opener.document.location.href="url of the page".
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
modal window:

parent window

I agree. Here's the link:
subject: Refreshing parent window
It's not a secret anymore!