try a simple alert to test the <body onload=

you can try my other suggestions but i think the tiles way should work.

On 2 Mar 2004, at 23:39, Alan Weissman wrote:

Thanks Mark for your response.

The issue is that even without my layout, which contains the <body> tag,
if I add an onLoad event it is not fired.


I have already tried calling the javascript function from somewhere in
the page however it is always called before the entire page is actually
rendered, which means that certain items on the page that the function
operates on do not have all of their properties.

Is there no way to mimic a body onLoad completely?

Thanks,
Alan


-----Original Message----- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 02, 2004 5:34 PM To: Struts Users Mailing List Subject: Re: BODY onLoad Workaround

Iframe would be one possible hack. Have the page that loads run a
javascript function that drills back up to your page.

or an onload on an image, or simply execute the function in the page.

lastly have something like this in your layout

<tile:get name="javascriptHack" scope="page" />

<script language="javascript" type="text/javascript">
<!--
function myfuction() {
        <c:out value="${javascriptHack}" />;
}
//-->
</script>
<body onload="myfuction()">

Stick your method as a put in that tile and have it empty for those
page where not required.

<put name="javascriptHack" value="alert('my javascript hack')"
type="string" />

the rest of the time

<put name="javascriptHack" value="" type="string" />

So the function always runs just usually contains nothing.


On 2 Mar 2004, at 23:14, Alan Weissman wrote:


Hey everyone -



            So I have a Struts/Tiles page that I need to have a
Javascript function called on when the page loads.  Normally this is
of
course accomplished with the BODY onLoad event however this event
isn't
fired when my page loads and from doing extensive Googling I've found
that this has something to do with the nature of Struts/Tiles pages
(though I'm not sure what).  What is the best workaround for this?



Thanks so much,

Alan



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



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



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



Reply via email to