Frank-
Yikes, I had no idea this thread would take on a life of its
own...regardless, the execScripts function was exactly what I was
looking for....had to tweak it to accomodate for the
"type='text/javascript'" attribute on an opening <script> tag, but it works.
The situation has actually become rather complicated. Before, we just
has a JSP making an AJAX call and dumping the response in an iframe.
The problem with that is that if the user's session expired and for
whatever reason, the page didn't refresh as designed, then any action by
the user in the iframe would cause the iframe to display our login
page...not good...
So, the solution I was thinking of and have started implementing is to
use a <div> instead by taking the results of the AJAX call and dump them
in the <div> and display it. This is slowly becoming a nightmare as I'm
running into scoping issues w/ J/S functions not being seen by HTML
widgets in the <div> contents etc. Additionally, I had to construct an
AJAX POST routine for submitting the contents of the <div> for saving
which opens another can of worms w.r.t. encoding the parameters
correctly, etc and correctly dealing with save failures and displaying
them to the user.
I just spoke w/ our proj. mgr. we've decided to leave the iframe in
because we're redoing the JSP page where this problem is situated for
version 2.0 of our web app.
But thanks for the heads up - it did work.
-Adam
Frank W. Zammetti wrote:
Hi Adam,
If your doing straight AJAX yourself, i.e., directly interacting with the
XMLHttpRequest object, this won't execute script for you automatically.
In fact, it won't do much of anything for you automatially, aside from
parsing XML if that's your return type. Otherwise, it's just text to the
object and you'll have to execute scripts yourself.
Another poster gave you some info if your using S2, but I'm guessing by
your description your using S1. In that case, continue reading! :)
The AjaxParts Taglib (APT) in Java Web Parts (JWP) takes care of this for
you... you can certainly switch over to using APT, but if you just want
some code to execute scripts, take a look here:
http://javawebparts.cvs.sourceforge.net/javawebparts/javawebparts/WEB-INF/src/javawebparts/ajaxparts/taglib/resources/AjaxPartsTaglib.js?view=markup
Down around line 313 you'll find the execScripts() function... simply yank
that out and use it on the responseText from XMLHttpRequest and you'll be
good to go.
If you are interested in looking at APT, here's a link:
http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html
And for JWP in general:
http://javawebparts.sourceforge.net
Hth,
Frank
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]