简体   繁体   中英

Close popup on submit and display results in parent window

How do I display results in parent window when a button is clicked on the child window(popup window)?

I have a jsp page. When I click a button on this page, it goes and fetches a list( studentList ) of Student objects and displays only their first name in a pop up window as follows.

A Student object has all the informations such as first name, last name, birth date, address etc.

There are checkboxes next to each name.

Jack    Tom     Paige
Julie   Hank    Red
Frank   Tina    May

What I want to be able to do is when I check the check box(es) and click a button in popup, I want to close the pop up window and display all the details about the students selected in the parent window.

When displaying the student details, I intend to get the students details from the list of students( studentLists ) that I already have instead of running a query against the database.

I am using Struts 1.

If domain of parent window and child window are same then you can access parent window using window.opener . using window.opener you can call parent window methods.

parent window:

window.childwindowAction = function(arg1, arg2,....){

   //  do stuff
};

child window

window.opener.childwindowAction (arg2, arg2, ..);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM