Thanks for the replies, Martin and Li.

So, I've tried both of these things (before resorting to the mailing list,
actually), but as I pointed out in my note, the inline <script> tag never
seems to get executed, despite my setting of the *executeScripts* attribute
in the containing action's <sx:div> tag.

Again, I have this containing action, call it *parent.action* with something
like this:

<sx:div href="child.action" executeScripts="true" />


And then in the child, this:

... html/jsp code...
<script>

alert("blah blah blah");

</script>


So, that script never gets run.  Even when I put the dojo.addOnLoad() into
that script...  the script never gets run.

Is there some bug in the executeScripts attribute?  Is there some other
mechanism that might be stripping or otherwise preventing the script from
executing?

Thanks,
Colin



On Wed, Dec 1, 2010 at 9:15 PM, Martin Gainty <mgai...@hotmail.com> wrote:

>
> Construct your JSP page with a script for an OnLoad JS function e.g.
>
>    <script>
>        var index = -1;
>        var runningOgnl = true;
>        var ognlBase = "${ognlBase}";
>        var jspBase = "${jspBase}";
>        var ognlCount = 9;
>        var jspCount = 5;
>
>        dojo.addOnLoad(function() {
>            var classSrc = dojo.byId("classSrc");
>            dojo.io.updateNode(classSrc, "${viewClass}");
>            dojo.html.hide("previous");
>            dojo.html.hide("next");
>        });
>
>        dojo.event.topic.subscribe("/reloadGuide", function() {
>            next();
>        });
>
>        function startOgnl() {
>            selectOGNLTab();
>            index = -1;
>            runningOgnl = true;
>            change(1);
>            updateNavigation();
>        }
>
>        function startJSP() {
>            selectJSPTab();
>            index = -1;
>            runningOgnl = false;
>            change(1);
>            updateNavigation();
>        }
>
>        function execOgnl(id) {
>            var exp = dojo.string.trim(dojo.byId(id ? id :
> "example").innerHTML);
>            dojo.byId("wc-command").value = exp;
>
>            keyEvent({keyCode : 13}, '${jspEval}');
>        }
>
>        function execJSP(id) {
>            var exp = dojo.string.trim(dojo.byId(id ? id :
> "example").innerHTML);
>            dojo.byId("jsp").value = unscape(exp);
>
>            dojo.event.topic.publish("/evalJSP")
>        }
>
>        function unscape(str) {
>            return str.replace(/&/gm, "&").replace(/</gm,
> "<").replace(/>/gm, ">").replace(/"/gm, '"');
>        }
>
>        function selectClassSrcTab() {
>            dojo.widget.byId("mainTabContainer").selectTab("classTab");
>        }
>
>        function selectJSPTab() {
>            dojo.widget.byId("mainTabContainer").selectTab("jspTab");
>        }
>
>        function selectOGNLTab() {
>            dojo.widget.byId("mainTabContainer").selectTab("ognlTab");
>        }
>
>        function change(delta) {
>            index+=delta;
>
>            var url = (runningOgnl ? ognlBase : jspBase) + index + ".jsp";
>            var bind = dojo.widget.byId("guideBind");
>            bind.href = url;
>            dojo.event.topic.publish("/loadContent");
>            updateNavigation();
>        }
>
>        function updateNavigation() {
>            if(index <= 0) {
>                dojo.html.hide("previous");
>            } else {
>                dojo.html.show("previous");
>            }
>
>            var top = runningOgnl ? ognlCount : jspCount;
>
>            if(index == top - 1) {
>                dojo.html.hide("next");
>            } else {
>                dojo.html.show("next");
>            }
>        }
>    </script>
>
> Martin Gainty
> ______________________________________________
> Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
> Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
>
> Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
> jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése
> nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi
> alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen
> megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet
> tartalma miatt.
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
>
>
>
>
>
> > Date: Thu, 2 Dec 2010 09:05:00 +0900
> > Subject: Re: execute javascript after action's html renders
> > From: liying.cn.2...@gmail.com
> > To: user@struts.apache.org
> >
> > Do you mean calling one action, from another action page, using AJAX?
> >
> > Let's say, ActionA is the container page, some AJAX code running in
> > this page, retrieving the response of ActionB, and append the response
> > to the container page.
> >
> > Do I understand it right?
> >
> > In this case, you can embed JavaScript code, in the page code of ActionB,
> likes:
> >
> > ===========================================
> > <html code start>
> > </html code end>
> >
> > <script type="text/javascript">
> > do something here.
> > </script>
> > ===========================================
> >
> > or you can use the "success" event of AJAX.
> > See: http://api.jquery.com/jQuery.ajax/
> > for more information.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
>
>

Reply via email to