Hi All,
I am using
Struts 2, and I have a form, that is displayed in an iframe. When submitted the form should, once finished processing, update the parent. This I have achieved through setting target="_parent" in the form tag on that page.
However if there are validation errors, such as a field in the form is not correctly entered. Then I dont wish to update the parent as I would be expecting an error to be returned from the validator.
So firstly is there any way of controlling this kind of behaviour, such as if correctly processed, update parent, if incorrectly processed update self...
Secondly if there is no simple way of achieving this, can I change the form so that if an error is returned it doesnt continue to set the target for the form as the parent. Because I have several nested iframes consecutive errors progress up throuh the various nested iframes destroying/replacing them. I could live with this occuring once, but not subsequent times...
I can check if an error is returned easily enough, but so far have not been able to alter the form tag in a way that would work....
for example what should work is something like this...
However this fails to compile complaining of a missing </s:form> tag, even though one exists.
Similarly if I do the check within the form tag it also fails....
Complaining that the s:form tag is not correctly formatted.
While neither of the two above code fragments are a perfect solution (far from it) they would at least solve the immediate problem. But neither seem to pass the compiler...
Edited: Oops, I am guessing that the first code fragment fails because I am incorrectly nexting the tags, that the </s:form> tag needs to be within the if statement.
However if I do the same thing through a standard
JSP code fragment such as:
It still fails...
Thanks
Michael