• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

updating ArrayList on parent from child window

 
Nick Gatsis
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. This is my first time on this forum and unfortunately I don't have example code to illustrate my problem, so I have a rather lengthly explanation. Please look at it as I have been rocking my brains for a week now. Thanks.

1) parent and child have own Action and ActionForm classes, all with scope=request; scope=session is not really an option.
2) parent JSP that renders parent ActionForm contains 5 elements:
1) text box to enter a group name
2) text box for effective date
3) text box for expiration date
4) <table> with <logic:iteration id="assgndAM" index="iAssgndAM"> to render contents of ArrayList<AccountManager>. This ArrayList is an instance variable on the parent ActionForm bean and uses Lazy List processing to automatically grow the ArrayList. This is done when parent ActionForm is loaded the first time and subsequent times.
a) four fields displayed: <html:checkbox>, and 3 text boxes.
5) <input type=button onclick=addToGroup()>
a) JavaScript linked to parent JSP that opens a new window and passing "childAction.do" and a string concatenation of all the elements to be displayed.
b) string parameter of all elements is loaded into ArrayList of the child ActionForm bean when childAction is called.
3) child JSP that renders child ActionForm contains three elements
1) <table> with <logic:iteration id="assgnAbleAM" index="iAssgnAbleAM">. This too is an ArrayList<AccountManager> as a instance variable on the child ActionForm bean.
a) three fields displayed in table: <html:checkbox>, and two text boxes.
2) <input type=button value="Add" name="Add onClick="addManagers()">
a) user presses button and passes all the items checked from table as a string to parent Action using document.form.action=parentAction.do. Parent Action grows and loads ArrayList<AccountManager> with string parameter contents.
3) <input type=button value="Cancel"> closes the popup window.
4) process flow:
1) user goes to parent JSP and enters data in text boxes.
2) user presses "Add To Group" button on parent JSP which launches child popup window.
3) user checks people to add to group and presses "Add" button on child popup window. Popup closes.
4) parent JSP now shows items checked from child window.
5) user presses "Add To Group" button on parent JSP again to add more.
5) problem is on subsequent adds because of scope=request, new parent ActionForm is being created and ArrayList<AccountManager> is empty. However, the three other instance variables, which are associated to the text boxes on the main JSP, are populated on parent ActionForm bean. Bottom line, I am losing the contents of the ArrayList<AccountManager> everytime after the first time when going from child to parent.






 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't help you much without knowing the code.
But if this is your problem,
Nick Gatsis wrote:5) problem is on subsequent adds because of scope=request, new parent ActionForm is being created and ArrayList<AccountManager> is empty.

the use session scope.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic