• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to persist data of child window form

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 81
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 81
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 81
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you paste the code you have written to open the child window ?
 
You guys wanna see my fabulous new place? Or do you wanna look at this tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic