I have a parent jsp called parent.jsp. This spawns an iframe called iframe1, which in turn frames an iframe called iframe2 .
From parent.jsp :
<iframe id="iframe1" style="display:none;" height="430"
width="675"
src="iframe1.jsp?myNumber=<%= bean.getMyNumber() %>" >
here, i get the mynumber in iframe1.jsp using :
String myNumber=request.getParameter("myNumber");
Now i need to pass it again to iframe2.jsp. For that i am calling a javascript method called : createSecondIframe(). Here i am using it like this :
createSecondIframe(myNumber)
{
ifrm.setAttribute("src", "iframe2.jsp?myNO=myNumber");
}
Here the iframe2 is getting created with all the visual content but the myNumber is not getting passed for when i do this :
System.out.println("MyNo::"+request.getParameter("myNO"));
I get, MyNO as null.
EDIT :
According to Bruno's suggestion , this the function calling createSecondIframe() :
function iframe1(myNumber)
{
var parentDynamicDiv = window.parent.document.getElementById('overlay1');
var iframe = window.parent.document.getElementById('container1');
iframe.style.display = 'none';
parentDynamicDiv.style.display = 'none';
createSecondIframe(myNumber);
}
Where i am going wrong? Kindly help .
You are not using the myNO variable but are specifying myNO as a string. Try this
Browser knows nothing about
myNumber
which exists in context of servlet. You have to explicitly define it somewhere inside client code.And later call
createSecondIframe
withmyNumber