You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dave Newton <da...@gmail.com> on 2010/12/01 22:22:24 UTC
Re: execute javascript after action's html renders
How is the JavaScript implemented in the child action?
And do you mean that an <s:action.../> tag is being used (from a JSP? FM?)
to load an action (the "child" from above)?
Dave
On Tue, Nov 30, 2010 at 4:50 PM, Colin Freas <cf...@gmail.com> wrote:
> On Struts 2.1.6, Dojo and JSON plugins.
>
> I want to execute some JavaScript after an action's HTML finishes loading.
>
> I can't figure out how to make this happen consistently. The action that
> I'm trying to modify is as part of another action. When I access the child
> action directly, the script runs. When I access it through the parent
> action, it doesn't.
>
> There is an attribute "executeScripts" (or similar) set, but... as near as
> I can tell, the script doesn't get run for some reason.
>
> So... what's the best way to ensure that a script gets run when it's
> loaded
> by an action? Where might this script be stripped or otherwise disabled
> from running?
>
> Any help appreciated.
>
> -Colin
>
Re: execute javascript after action's html renders
Posted by Colin Freas <cf...@gmail.com>.
So, the "parent" action is using a Dojo *div* tag, with the
*executeScripts* attribute
set to true.
The script in the "child" action, which is referenced in the *div* tag, is
inline JavaScript.
So parent is like:
<sx:div href="child.action" executeScripts="true" />
Child is:
... html/jsp fragments ...
<script>
alert("blah blah blah");
</script>
If I go to child.action from a browser, script runs. If I got to
parent.action, script doesn't run.
-Colin
On Wed, Dec 1, 2010 at 4:22 PM, Dave Newton <da...@gmail.com> wrote:
> How is the JavaScript implemented in the child action?
>
> And do you mean that an <s:action.../> tag is being used (from a JSP? FM?)
> to load an action (the "child" from above)?
>
> Dave
>
> On Tue, Nov 30, 2010 at 4:50 PM, Colin Freas <cf...@gmail.com> wrote:
>
> > On Struts 2.1.6, Dojo and JSON plugins.
> >
> > I want to execute some JavaScript after an action's HTML finishes
> loading.
> >
> > I can't figure out how to make this happen consistently. The action that
> > I'm trying to modify is as part of another action. When I access the
> child
> > action directly, the script runs. When I access it through the parent
> > action, it doesn't.
> >
> > There is an attribute "executeScripts" (or similar) set, but... as near
> as
> > I can tell, the script doesn't get run for some reason.
> >
> > So... what's the best way to ensure that a script gets run when it's
> > loaded
> > by an action? Where might this script be stripped or otherwise disabled
> > from running?
> >
> > Any help appreciated.
> >
> > -Colin
> >
>