Jsp nested iframe: submit the form from iframe and pass the value to the outer layer. nested iframe
Today, the Code encountered such a problem due to iterative metadata change.
I just want to jump to the whole page after submitting in iframe and pass the value in iframe to the outer jsp
Probably like this.
Outer a. jsp
<div id="d"></div><iframe src="b.jsp" name="listresult" width="100%" height="100%" frameborder="0"></iframe>
Inner Layer B. jsp
<Form action = '... do'>...
<Input type = 'did' name = 'A' value = 'A'/> <input type = 'submit 'value = 'Submit'/> </form>
So take it for granted that the start code is
I plan to use js to assign values and write a js in B. jsp.
$('#d').val('<s:property value="a"/>');
Although the value of the hidden domain can be obtained, the outer value is not passed.
Result failed
Then various searches finally found a feasible method.
The idea is to write a method in B. jsp to call the js method in a. jsp, implement the jump, and then assign a value in a. jsp.
Good Code
B. jsp
window.parent.f1('<s:property value="a"/>');
A. jsp
function f1(value){ window.parent.document.getElementById('main').src = '....do?a='+value;}
---------------------------- Separation line ---------------------------------------
The following information is found on the Internet:Window. parent.
Good reception