How to refresh my browser, when user performs some action

In my jsp page, i have a button when it is clicked i will
open a new window (using java script window.open()).
 when the new window is submitted, i need to close
the new window and refresh the main page.
How do i do it?

Thanks in advance
Arru


 
arru_inAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arru_inAuthor Commented:
To close the new window, i tried window.close(),its working.. but how to refresh the parent window?

is there any way to do it in javascript something like window.opener.document.refresh() ?
knightEknightCommented:
try this:

self.opener.location = ""+self.opener.location.href;
self.close();
knightEknightCommented:
also, where is this code in relation to the form being submitted?  is it after the form submits and returns, or is it just before the form submits?

If the later, then you want to do this in this order:

self.opener.location = ""+self.opener.location.href;
document.forms[0].submit();
setTimtout("self.close()",500);
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

knightEknightCommented:
doh!  sorry!  i put it in the wrong order myself!


self.opener.location = ""+self.opener.location.href;
setTimtout("self.close()",500);
document.forms[0].submit();


of course, by attempting this at all, there is no guarantee that the parent window will be refreshed with the form data -- IF you are doing the refresh and close BEFORE the form submits.
knightEknightCommented:
... the better way is to do it AFTER the form submits and returns to the popup.  Then you can do this:

<BODY onload='self.opener.location=""+self.opener.location.href;self.close();'>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
arru_inAuthor Commented:
thanks knightEknight it works.. the main page is refreshed
but i have a java script tree in the main page which is not in fully expanded form. anyway thats my problem..
thanks
Arru
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.