I have a pretty weird problem, here it goes:
I have a jsp page, in this jsp, there is an iframe showing some content from another jsp. I want this iframe to be refreshed in the <body onload="blabla"..>
So what I tried to do is, I converted the static HTML iframe code into a java code in a method. So it was like this:
.
.
html here …
<iframe ... blabla>
</iframe
html here..
.
.
And I did it like:
<body onload="refreshiframe();">
.
.
html here …
<%! void refreshiframe()
{
out.print("<iframe.. blabla> </iframe>");
}
%>
html here …
.
.
But the problem is, the out.print inside refreshiframe gives compile error. My compiler, jdeveloper 10g, specifically says that “variable ‘out’ not found”. I can use out.print outside of the method but not inside the method. How can I use out.print in the refreshiframe() method ? or is there a better way to solve this problem ? Thank you.
Indeed, you’re confusing Java/JSP with JavaScript.
The
<body onload>should point to a JavaScript function, not to a Java/JSP method. If I understand you right, you want to refresh/reload the content of an iframe? If so, add the following to the<head>of your HTML document.And give your
<iframe>element anid="frameId".