Struts: returning to main window

D

Dave

I understand that I can navigate to a new window by specifying a target
in the form element. Like this:

<html:form action="Edit" target="popup" >

When I submit this form, the Edit JSP pops up in a new window.

The new window also has a submit button. The form element looks like
this:

<html:form action="Data">

What I wanted was that the Data form would reload in the original window
and the Edit form close.

What happens though is that submitting the data form brings up the edit
form in a new window. Submitting the edit form redisplays the Data form
in the 2nd window. I can then continually sumbit the forms, Data, Edit,
Data, Edit and they stay in the 2nd window. The original window is
still in the background in its original state.

It's not what I was expecting but it makes some sense. The Data form
causes the Edit window to comeup in a new window called "Popup". The
Edit form doesn't specify a target so the Data form appears in the same
window, the 2nd one, as the Edit form. Launching the Edit form a 2nd
time does not launch a 3rd window because the 2nd window is the target
"Popup"

How can I return to the main window after the Edit window is submitted?
Is there a special target for the main window?
 
O

Oscar kind

Dave said:
I understand that I can navigate to a new window by specifying a target
in the form element. Like this:

<html:form action="Edit" target="popup" >

When I submit this form, the Edit JSP pops up in a new window.

The new window also has a submit button. The form element looks like
this:

<html:form action="Data">

What I wanted was that the Data form would reload in the original window
and the Edit form close.
[...]

How can I return to the main window after the Edit window is submitted?
Is there a special target for the main window?

No; the special targets are "_blank", "_self", "_parent" and "_top".
For more information, see the HTML specs:
http://www.w3.org/TR/html4/types.html#h-6.16

You need to specify the name of the original frame/window as the target.
Otherwise, the current window ("popup") will be used.

Some tips:
- Either open the application in a named frame (it may open in a new
frame), or set it's name using "window.name = 'newName';". This last
option is JavaScript.
- Use a little piece of JavaScript to close the "popup" window.
- To set fields on the main window, reference the named window, or use
"window.opener" (also a window object).

For more advise, see .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top