0

I am working on jsp's, I have two jsp one in configDb.jsp, in that I have written code to retrieve the values from database and display it. In this whereas I have option like newconnection.. its a popup window. When I click on that it opens popupwindow and taken the values and store them in a database, but in my parent page I am not able to display those values. After I click on the ok button in popup window, I have to refresh the parent page, then I am able to see the values which I have created few seconds back by the new connection page. Could anyone please help me out?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Madhuri
  • 187
  • 1
  • 4
  • 10

1 Answers1

0

You can include this in your HTML for the popup window.

<script type="text/javascript">
function proceed(){
   opener.location.reload(true);
   self.close();
}
</script>

<form onsubmit="proceed()">
...
</form>

Actually you can obtain the answer by googling "javascript refresh parent page from popup" and you will see stackoverflow's answer :)

A better alternative without the need of refreshing the parent page can be achieved by adding a submit button listener and perform a DOM action to insert the new element with new content. This can be easily done by Javascript.

Community
  • 1
  • 1
  • thank u for ur fast response, but its not working..my parent jsp has popup window ..on click on link in parent jsp,it opens popup & take the values & save those in database in another jsp , for example my parnt window is configDB.jsp & click the link onconfigDB.jsp, it opens properties.jsp then in properties.jsp, if we click on save button the it goes to saveconfig1.jsp.. in that alert comes., if u click on alert button , it automatically closes the pop up window.. but here my problem is after closing the popup window how can i refresh the parent page.. – Madhuri Jun 28 '12 at 11:01