File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes How to persist data of child window form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to persist data of child window form" Watch "How to persist data of child window form" New topic
Author

How to persist data of child window form

Sameer Ahmed
Greenhorn

Joined: Apr 15, 2011
Posts: 11
Hi

I want to do the following.

On clicking a button in the main JSP a new child window should open and in the child window there is a small form, on pressing the OK button on the form the child window should close and the data should persist in the bean. now on clicking the submit button main JSP the data of child window should be saved in the database.
How can I do this. ?
I have created separate action class and bean for child window, but the data does not persist in the bean after clicking the OK button.

I am using struts 2
Santhosh ayiappan
Ranch Hand

Joined: Jan 30, 2007
Posts: 80

I can think of the following,

1. When you click on the submit button of the child window, invoke a action class. In the action class create a method to map the values from the child windows form bean to parent windows form bean. Once the mapping is done, forward your request to the parent window which would have the values of your child window as well.

2. Have hidden fields in your parent window for all the fields that you might have in your child window. Use Java script to populate the values down to the parent window from the child window as soon as the onclick of the child windows submit button is triggered.


Sameer Ahmed
Greenhorn

Joined: Apr 15, 2011
Posts: 11
actually i have 14 jsps and one common child window, so i cannot have the chiild window attibute in all 14 jsp beans.

i have another question.
How can open a child window WITHOUT refeshing/reloading parent window ?
I want to open a child window by clicking a submit button and not a link.
am using window.open ut it refrshes my parent window.

please help
Santhosh ayiappan
Ranch Hand

Joined: Jan 30, 2007
Posts: 80

"actually i have 14 jsps and one common child window, so i cannot have the chiild window attibute in all 14 jsp beans. "

Create a class that has the attributes of the child window and extend this class in all the 14 parent JSP's.

Santhosh ayiappan
Ranch Hand

Joined: Jan 30, 2007
Posts: 80

Can you paste the code you have written to open the child window ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to persist data of child window form