Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

popup submission should trigger .do, close popup, reload originating p

Status
Not open for further replies.

aturetsky

Programmer
Apr 28, 2005
12
US
I have a A.jsp that gets displayed when one goes to This A.jsp contains a link to a popup B.jsp. The form in B.jsp is then submitted to B.do which saves the data entered in that form to the DB. That part is working.

What I need to happen is that when that form in B.jsp popup is submitted, the system should not only 1) go to the action B.do, but also 2) close the B.jsp popup and reload the page that triggered that, i.e. A.jsp(which means reloading the url)

How do I do that? Please specify the solution as clearly as possible

Thank you so much!
 
Hi,

The target page of B.do will have the javascript which will first reload A.do and close the window.

B.do should forward to this page once it inserts the data in the DB.

Example closeWindow.jsp
Code:
<%@ page contentType="text/html;charset=windows-1252"%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Close Window</title>
  </head>
  <body>
   <script language="javascript"><!--
      opener.location.href = opener.location.href;
      window.close();
   //-->
   </script>
  </body>
</html>

Cheers
Venu
 
Venu, I like that approach and appreciate the prompt response. But don't understand the javascript. Firstly, why are the main lines commented out. Secondly, what does this identical assignment do: opener.location.href = opener.location.href;
 
Hi,

The lines are not commented out, that is the standard of writing the javascript inside a page. And the below Line will reload the parent window with URL what's on the parent window ie., in you case.
opener.location.href = opener.location.href;

Cheers
Venu
 
Thanks again. Can you tell me more about the purpose of those <!--> tags, that you mentioned are a standard for writing javascript inside a page. Would the page not work the same without them?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top