Martin-

I could, but it's really nasty. I've pasted the function where I use execScripts() below. See my response to Frank prior to this response. Basically the JSP page we're requesting via the AJAX call is dynamically building an HTML table with options retrieved from the database and preloaded into a J/S array using JSTL tags. After the array is loaded, we build the HTML table from the contents of the array. The problem became apparent when the function to rebuild the table at page load time was not being executed and we ran into scoping problems with the J/S functions. I wound up having to put them in the outer page and it made the two JSP's so tightly coupled that it made almost no sense to have separate JSPs...

Anyway, we've decided to leave the iframe in there for now as this page is going to be redone by our sub for version 2.0.

 function popCustomRegPanel(recordingId) {

   var url = "RecordingCustomRegistration.do?id=" + recordingId;

   loadXMLDoc(url,

     function() {

       if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {

// this checks to make sure our session is still active and we have not
         // been logged out
         if (xmlhttp.getResponseHeader("validSession")) {

           // retrieve the response text (HTML) and evaluate the JavaScript
           // code so that the table is generated correctly.
           var customRegContentDiv =
             document.getElementById('customRegContent');

           customRegContentDiv.innerHTML = xmlhttp.responseText;
           execScripts(customRegContentDiv.innerHTML);

           show('customRegPanel');
           show('disable');
         }
         else {
           // reload the page and dump user at login page
           window.location.reload();
         }
       }
     });
 }

-adam

Martin Gainty wrote:
Hi Adam-

Could you post your JSP?
in particular could we see XMLHttpRequest.OnReadyStateChange AND the javascript 
function which is the receptor for the Asynchronous call

Thanks,
M
This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents ----- Original Message ----- From: "Adam Gordon" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Tuesday, November 28, 2006 3:43 PM
Subject: Struts, AJAX, JSP, and JavaScript question


I have a JSP and there's a link in the rendered page that makes an AJAX call
(to a Struts action) when clicked.  The results of that action, and the
contents of the response are set as the innerHTML on a hidden <div> defined
inside the afore mentioned rendered page.  The <div> is then un-hid.

Everything is working correctly except for one part:  When the div is
displayed, the JavaScript code in the contents returned by the AJAX call
isn't being executed and thus, the contents of the <div> aren't set up
correctly.

Does anyone know a way to have the JavaScript be executed?  Or force the
browser to execute it?
I used to have an <iframe> and everything worked great, but there was a bad
side effect with session timeouts and so we've decided to not use them.

Any help would be appreciated.  Thanks.

-Adam



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to