This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Struts and the fly likes Update Value from a child window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Update Value from a child window" Watch "Update Value from a child window" New topic
Author

Update Value from a child window

Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
Hi Folks,
I have a peculiar issue with Parent & Child window in struts & tiles.

I have a parent window - that has a dropdown values & a submit button. On click of the button, it must open a popup window which is mostly static (but for a couple of session values) with 2 buttons - 'Continue' and 'Cancel'.

When user clicks on
a. 'Cancel' button, I need to close the popup window w/o doing anything to the parent window.
b. 'Continue' button, I need to close the popup window with the parent window refreshing and deleting the value that was selected in the dropdown before the popup window was shown.
NOTE: The parent window is implemented in struts/tiles whereas the popup is just a jsp page, since the popup is almost static and doesnt have a header/footer like the parent window.

Does any one has any idea on how to go about doing this?
I tried the following ways but without any luck -
1. create a form with a hidden field in the parent and try and set the value from the child javascript function that is called when 'Continue' button is clicked... - This doesnt work since it looses the request value as soon as the child window is closed.
2. Tried with the above in combination with [html:link ../] surronding the [html:img ../] tag - this somewhat works as it opens up a new window from the child window and hence retains the request value...
3. Tried using 2 different actions for 'Continue' and for 'Cancel' button - but this didnt work either... not sure of the exact reason...
Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
Here is the code for the above issue -

[CODE]
{struts-config.x ml}
<action path="/account/deleteChoice" type="com.epson.edm.struts.actions.account.DeleteChoiceAction">
<forward name="success" path="deleteSelected"/>
</action>
[/action]

{tiles-defs.xm l }
<definition name="deleteSelected" extends="account.myDef">
<put name="title" value="Account Settings - Delete Selected"/>
<put name="content" value="/WEB-INF/jsp/tiles/account/parent.jsp"/>
</definition>

NOTE: I am not able to add the html/jsp into the forum... in case you wanted the html/jsp code to understand my code issue...
[ August 03, 2007: Message edited by: Bhaskar Reddy ]
Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
I got this resolved after I created a hidden variable in the parent form which was set using Javascript function calls from both the parent & the popup window button click.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Update Value from a child window
 
Similar Threads
error in passing values from child window to parent window
Passing values from child to parent window
updating ArrayList on parent from child window
close child Window and reload parent window
Add and Edit a row