javascript - JSP output to IFrame -


i have posted relative question: java servlet: delete temporary file

as per suggestion of @balusc, have been trying implement different, no success.

therefore, want ask following: possible "inject" html contents iframe @ runtime?

just clarify, working servlets , jsp. have 1 servlet on dopost populates , displays jsp page. page follows:

<%@ page language="java" contenttype="text/html; charset=iso-8859-1"     pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head>  <script> function disp() {   alert(document.getelementbyid('ifrm').contentdocument.documentelement.innerhtml); }  </script>      <style type="text/css">   html, body, div { margin:0; padding:0; height:100%; }   iframe { display:block; width:100%; height:90%; border:none; } </style>  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>this sparta!!</title> </head>  <body>   <a href='getter?url=<%= request.getrequesturi() %>&starter=fine'>close session</a>   <input type='button' onclick='disp()' value='source'></input>   want me load: <%= request.getparameter("url") %> , , here is:    <iframe id='ifrm' src='<%= request.getsession().getattribute("relpath") %>'></iframe> </body> </html> 

"relpath" attribute add session @ previous point, , represents relative path temporary file. works, have ulterior problem: links in page contained inside iframe appropriately changed function properly. effect 1 can navigate inside iframe if browser tab. so, when link on page clicked, temporary file gets re-written contents of site link points to. however, page not reloaded, , gather because browser retrives cached page, , not page browser. tried refreshing source of iframe via javascipt , functions, there delay, , page loads twice - don't want that. have tried doind document.write() in javascript on iframe object, again no success.

a last clarification: iframe should contain whole html of page, complete <html> , </html> tags: did think of creating jsp page div perhaps, , injecting content there, that's not want either...

thank in advance!

i managed resolve issue myself.

in end, came javascript. using beans, managed pass contents of page jsp page, , there "echo" lines of document 1 one. have advise interested encountered difficulties escaping special characters: had manually escape cr , lf in cases, , had handle existing </script> tags in page, cause javascript exit prematurely. managed overcome difficulty changing character '<' \x3c, has been suggested on thread here, on so.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -