File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes submitting  two forms at a time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "submitting  two forms at a time" Watch "submitting  two forms at a time" New topic

submitting two forms at a time

Kalyana Sundaram
Ranch Hand

Joined: Mar 18, 2005
Posts: 94
Hi guys,
I dont know if I were idiotic to ask this question. but this is situation i am facing now. In my struts application, I have a view which when submitted creates ActionForm and handled by Action and everything was OK.

But the problem started when I was supposed to include an IFRAME in the JSP. its like
<html:form action=/settings" >
<html:checkbox property="prop1" />
<html:checkbox property="prop2 />
<iframe scrolling=yes width=100% frameborder=1 src="" height=275 >

The JSp displayed by the IFRAME HAS its own Action form and Action classes.

So now the problem is user would be changing the properties in the outer JSP as well as the JSP displayed in IFRAME. I need to invoke the two actions for the outer JSP as wellas the one for IFRRAME

How this situation could be handled. Any workarounds possible.....

Only those who will risk going too far can possibly find out how far one can go !!!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
As far as HTML forms are concerned, the outer frame and the Iframe are two separate pages and are submitted separately. If you want the outer form to submit changes made in the inner form, I'd suggest creating hidden fields in the outer frame corresponding to fields in the iframe. You can then use javaScript to copy the fields from the Iframe to the outer frame before you submit the form in the outer frame.

Here is a sample javaScript function:

Alternatively you could use javascript to submit the iframe form at the same time you submit the outer form, like this:

[ May 09, 2005: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
I agree. Here's the link:
subject: submitting two forms at a time
It's not a secret anymore!