Discussion:
BODY onLoad Workaround
Alan Weissman
2004-03-02 22:14:17 UTC
Permalink
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
Mark Lowe
2004-03-02 22:33:51 UTC
Permalink
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.
Post by Alan Weissman
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
Alan Weissman
2004-03-02 22:39:11 UTC
Permalink
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:***@talk21.com]
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.
Post by Alan Weissman
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: struts-user-***@jakarta.apache.org
For additional commands, e-mail: struts-user-***@jakarta.apache.org
Mark Lowe
2004-03-02 22:51:34 UTC
Permalink
try a simple alert to test the <body onload=

you can try my other suggestions but i think the tiles way should work.
Post by Alan Weissman
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-----
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.
Post by Alan Weissman
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
Post by Alan Weissman
course accomplished with the BODY onLoad event however this event
isn't
Post by Alan Weissman
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
---------------------------------------------------------------------
---------------------------------------------------------------------
Mark Lowe
2004-03-02 22:39:06 UTC
Permalink
correction

<tiles:useAttribute name="javascriptHack" scope="page" />
Post by Mark Lowe
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.
Post by Alan Weissman
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
---------------------------------------------------------------------
Richard Yee
2004-03-02 22:44:57 UTC
Permalink
Alan,
I don't see any problem with using the BODY onLoad
event handler. I also searched on Google and found
several instances where others are using it without
any problems. What does your code look like? What
happens when you do a view/source in the browser? Have
you tried using Netscape and looking at the JavaScript
console?

-Richard
Post by Alan Weissman
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
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you�re looking for faster
http://search.yahoo.com
Alan Weissman
2004-03-02 22:51:37 UTC
Permalink
Thanks Richard for your input. Can you let me know where you see people
using it? I have an onLoad="alert('body onload')" on my BODY tag which
resides in my layout and it is not being called.

I also found this, which leads me to believe that I am not alone in this
problem. I am however, not able to find where to download the tag
library the page refers to.

http://retep.org/retep/wiki/retep/taglib/common/onload/index.html

Thanks again,
Alan

-----Original Message-----
From: Richard Yee [mailto:***@yahoo.com]
Sent: Tuesday, March 02, 2004 5:45 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround

Alan,
I don't see any problem with using the BODY onLoad
event handler. I also searched on Google and found
several instances where others are using it without
any problems. What does your code look like? What
happens when you do a view/source in the browser? Have
you tried using Netscape and looking at the JavaScript
console?

-Richard
Post by Alan Weissman
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
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-***@jakarta.apache.org
For additional commands, e-mail: struts-user-***@jakarta.apache.org
Mark Lowe
2004-03-02 23:00:09 UTC
Permalink
I guess its possible that the layout isn't getting reloaded with the
tiles request.

an iframe or an image will do as a quick hack.

<iframe width="0" height="0" src="foo.html" />
Post by Alan Weissman
Thanks Richard for your input. Can you let me know where you see people
using it? I have an onLoad="alert('body onload')" on my BODY tag which
resides in my layout and it is not being called.
I also found this, which leads me to believe that I am not alone in this
problem. I am however, not able to find where to download the tag
library the page refers to.
http://retep.org/retep/wiki/retep/taglib/common/onload/index.html
Thanks again,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 5:45 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
Alan,
I don't see any problem with using the BODY onLoad
event handler. I also searched on Google and found
several instances where others are using it without
any problems. What does your code look like? What
happens when you do a view/source in the browser? Have
you tried using Netscape and looking at the JavaScript
console?
-Richard
Post by Alan Weissman
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
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster
http://search.yahoo.com
---------------------------------------------------------------------
---------------------------------------------------------------------
Alan Weissman
2004-03-02 23:03:07 UTC
Permalink
Hey Mark, could you explain what you mean? I've tried shutting down
Tomcat and restarting, which shouldn't make a difference. I can also
verify that onload="alert()" is part of the page by doing a view
source.

Thanks,
Alan

-----Original Message-----
From: Mark Lowe [mailto:***@talk21.com]
Sent: Tuesday, March 02, 2004 6:00 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround

I guess its possible that the layout isn't getting reloaded with the
tiles request.

an iframe or an image will do as a quick hack.

<iframe width="0" height="0" src="foo.html" />
Post by Alan Weissman
Thanks Richard for your input. Can you let me know where you see people
using it? I have an onLoad="alert('body onload')" on my BODY tag which
resides in my layout and it is not being called.
I also found this, which leads me to believe that I am not alone in this
problem. I am however, not able to find where to download the tag
library the page refers to.
http://retep.org/retep/wiki/retep/taglib/common/onload/index.html
Thanks again,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 5:45 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
Alan,
I don't see any problem with using the BODY onLoad
event handler. I also searched on Google and found
several instances where others are using it without
any problems. What does your code look like? What
happens when you do a view/source in the browser? Have
you tried using Netscape and looking at the JavaScript
console?
-Richard
Post by Alan Weissman
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
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster
http://search.yahoo.com
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-***@jakarta.apache.org
For additional commands, e-mail: struts-user-***@jakarta.apache.org
Alan Weissman
2004-03-02 23:10:09 UTC
Permalink
Ok something incredibly strange is afoot:

If I do a view source and save the source code, then load the page from
the file system, the alert() works.

If I use IE to save the page and then load the page from the file
system, I do not get a full page saved, and though the alert() is in the
body tag, it is not called.

I have never run into anything like this before. Though I'm starting to
think this might not be a Struts/Tiles thing.

Any thoughts?

Thanks so much,
Alan

-----Original Message-----
From: Alan Weissman [mailto:***@nyc.yamaha.com]
Sent: Tuesday, March 02, 2004 6:03 PM
To: 'Struts Users Mailing List'
Subject: RE: BODY onLoad Workaround

Hey Mark, could you explain what you mean? I've tried shutting down
Tomcat and restarting, which shouldn't make a difference. I can also
verify that onload="alert()" is part of the page by doing a view
source.

Thanks,
Alan

-----Original Message-----
From: Mark Lowe [mailto:***@talk21.com]
Sent: Tuesday, March 02, 2004 6:00 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround

I guess its possible that the layout isn't getting reloaded with the
tiles request.

an iframe or an image will do as a quick hack.

<iframe width="0" height="0" src="foo.html" />
Post by Alan Weissman
Thanks Richard for your input. Can you let me know where you see people
using it? I have an onLoad="alert('body onload')" on my BODY tag which
resides in my layout and it is not being called.
I also found this, which leads me to believe that I am not alone in this
problem. I am however, not able to find where to download the tag
library the page refers to.
http://retep.org/retep/wiki/retep/taglib/common/onload/index.html
Thanks again,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 5:45 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
Alan,
I don't see any problem with using the BODY onLoad
event handler. I also searched on Google and found
several instances where others are using it without
any problems. What does your code look like? What
happens when you do a view/source in the browser? Have
you tried using Netscape and looking at the JavaScript
console?
-Richard
Post by Alan Weissman
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
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster
http://search.yahoo.com
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-***@jakarta.apache.org
For additional commands, e-mail: struts-user-***@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-***@jakarta.apache.org
For additional commands, e-mail: struts-user-***@jakarta.apache.org
r***@albany.edu
2004-03-02 23:15:10 UTC
Permalink
You cannot have an empty alert. At least under Firefox browser:

That is:

This works:
<html>
<body onload="alert('Hello')">
THe doc body.
</body>
</html>

But this doesn't:
<html>
<body onload="alert()">
THe doc body.
</body>
</html>

You can also try validating your page:
http://validator.w3.org/
You may have some bad HTML
-R^3
Post by Alan Weissman
If I do a view source and save the source code, then load the page from
the file system, the alert() works.
If I use IE to save the page and then load the page from the file
system, I do not get a full page saved, and though the alert() is in the
body tag, it is not called.
I have never run into anything like this before. Though I'm starting to
think this might not be a Struts/Tiles thing.
Any thoughts?
Thanks so much,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 6:03 PM
To: 'Struts Users Mailing List'
Subject: RE: BODY onLoad Workaround
Hey Mark, could you explain what you mean? I've tried shutting down
Tomcat and restarting, which shouldn't make a difference. I can also
verify that onload="alert()" is part of the page by doing a view
source.
Thanks,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 6:00 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
I guess its possible that the layout isn't getting reloaded with the
tiles request.
an iframe or an image will do as a quick hack.
<iframe width="0" height="0" src="foo.html" />
Post by Alan Weissman
Thanks Richard for your input. Can you let me know where you see people
using it? I have an onLoad="alert('body onload')" on my BODY tag
which
Post by Alan Weissman
resides in my layout and it is not being called.
I also found this, which leads me to believe that I am not alone in this
problem. I am however, not able to find where to download the tag
library the page refers to.
http://retep.org/retep/wiki/retep/taglib/common/onload/index.html
Thanks again,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 5:45 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
Alan,
I don't see any problem with using the BODY onLoad
event handler. I also searched on Google and found
several instances where others are using it without
any problems. What does your code look like? What
happens when you do a view/source in the browser? Have
you tried using Netscape and looking at the JavaScript
console?
-Richard
Post by Alan Weissman
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
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster
http://search.yahoo.com
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
|----------------------------------|
| Ryan Russo |
| russo@[noSPAM].albany.edu |
| University at Albany--Computing |
| <<remove [noSPAM] to e-mail>> |
| Technical Services Web Team |
|__________________________________|
Alan Weissman
2004-03-02 23:17:26 UTC
Permalink
This does not appear to be the problem. I have tried alerts with and
without values, calling other function which display alerts, etc.



-----Original Message-----
From: ***@albany.edu [mailto:***@albany.edu]
Sent: Tuesday, March 02, 2004 6:15 PM
To: Alan Weissman
Cc: 'Struts Users Mailing List'
Subject: RE: BODY onLoad Workaround

You cannot have an empty alert. At least under Firefox browser:

That is:

This works:
<html>
<body onload="alert('Hello')">
THe doc body.
</body>
</html>

But this doesn't:
<html>
<body onload="alert()">
THe doc body.
</body>
</html>

You can also try validating your page:
http://validator.w3.org/
You may have some bad HTML
-R^3
Post by Alan Weissman
If I do a view source and save the source code, then load the page from
the file system, the alert() works.
If I use IE to save the page and then load the page from the file
system, I do not get a full page saved, and though the alert() is in the
body tag, it is not called.
I have never run into anything like this before. Though I'm starting to
think this might not be a Struts/Tiles thing.
Any thoughts?
Thanks so much,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 6:03 PM
To: 'Struts Users Mailing List'
Subject: RE: BODY onLoad Workaround
Hey Mark, could you explain what you mean? I've tried shutting down
Tomcat and restarting, which shouldn't make a difference. I can also
verify that onload="alert()" is part of the page by doing a view
source.
Thanks,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 6:00 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
I guess its possible that the layout isn't getting reloaded with the
tiles request.
an iframe or an image will do as a quick hack.
<iframe width="0" height="0" src="foo.html" />
Post by Alan Weissman
Thanks Richard for your input. Can you let me know where you see people
using it? I have an onLoad="alert('body onload')" on my BODY tag
which
Post by Alan Weissman
resides in my layout and it is not being called.
I also found this, which leads me to believe that I am not alone in this
problem. I am however, not able to find where to download the tag
library the page refers to.
http://retep.org/retep/wiki/retep/taglib/common/onload/index.html
Thanks again,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 5:45 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
Alan,
I don't see any problem with using the BODY onLoad
event handler. I also searched on Google and found
several instances where others are using it without
any problems. What does your code look like? What
happens when you do a view/source in the browser? Have
you tried using Netscape and looking at the JavaScript
console?
-Richard
Post by Alan Weissman
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
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster
http://search.yahoo.com
---------------------------------------------------------------------
---------------------------------------------------------------------
Post by Alan Weissman
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
|----------------------------------|
| Ryan Russo |
| russo@[noSPAM].albany.edu |
| University at Albany--Computing |
| <<remove [noSPAM] to e-mail>> |
| Technical Services Web Team |
|__________________________________|

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-***@jakarta.apache.org
For additional commands, e-mail: struts-user-***@jakarta.apache.org
Richard Yee
2004-03-02 23:18:10 UTC
Permalink
Interesting...

Empty alerts work fine in IE.

-Richard
Post by r***@albany.edu
You cannot have an empty alert. At least under
<html>
<body onload="alert('Hello')">
THe doc body.
</body>
</html>
<html>
<body onload="alert()">
THe doc body.
</body>
</html>
http://validator.w3.org/
You may have some bad HTML
-R^3
Post by Alan Weissman
If I do a view source and save the source code,
then load the page from
Post by Alan Weissman
the file system, the alert() works.
If I use IE to save the page and then load the
page from the file
Post by Alan Weissman
system, I do not get a full page saved, and though
the alert() is in the
Post by Alan Weissman
body tag, it is not called.
I have never run into anything like this before.
Though I'm starting to
Post by Alan Weissman
think this might not be a Struts/Tiles thing.
Any thoughts?
Thanks so much,
Alan
-----Original Message-----
From: Alan Weissman
Sent: Tuesday, March 02, 2004 6:03 PM
To: 'Struts Users Mailing List'
Subject: RE: BODY onLoad Workaround
Hey Mark, could you explain what you mean? I've
tried shutting down
Post by Alan Weissman
Tomcat and restarting, which shouldn't make a
difference. I can also
Post by Alan Weissman
verify that onload="alert()" is part of the page
by doing a view
Post by Alan Weissman
source.
Thanks,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 6:00 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
I guess its possible that the layout isn't getting
reloaded with the
Post by Alan Weissman
tiles request.
an iframe or an image will do as a quick hack.
<iframe width="0" height="0" src="foo.html" />
Post by Alan Weissman
Thanks Richard for your input. Can you let me
know where you see
Post by Alan Weissman
Post by Alan Weissman
people
using it? I have an onLoad="alert('body
onload')" on my BODY tag
Post by Alan Weissman
which
Post by Alan Weissman
resides in my layout and it is not being called.
I also found this, which leads me to believe
that I am not alone in
Post by Alan Weissman
Post by Alan Weissman
this
problem. I am however, not able to find where
to download the tag
Post by Alan Weissman
Post by Alan Weissman
library the page refers to.
http://retep.org/retep/wiki/retep/taglib/common/onload/index.html
Post by r***@albany.edu
Post by Alan Weissman
Post by Alan Weissman
Thanks again,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 5:45 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
Alan,
I don't see any problem with using the BODY
onLoad
Post by Alan Weissman
Post by Alan Weissman
event handler. I also searched on Google and
found
Post by Alan Weissman
Post by Alan Weissman
several instances where others are using it
without
Post by Alan Weissman
Post by Alan Weissman
any problems. What does your code look like?
What
Post by Alan Weissman
Post by Alan Weissman
happens when you do a view/source in the
browser? Have
Post by Alan Weissman
Post by Alan Weissman
you tried using Netscape and looking at the
JavaScript
Post by Alan Weissman
Post by Alan Weissman
console?
-Richard
Post by Alan Weissman
Hey everyone -
So I have a Struts/Tiles page that
I
Post by Alan Weissman
Post by Alan Weissman
Post by Alan Weissman
need to have a
Javascript function called on when the page
loads.
Post by Alan Weissman
Post by Alan Weissman
Post by Alan Weissman
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
Post by Alan Weissman
Post by Alan Weissman
Post by Alan Weissman
Googling I've found
that this has something to do with the nature
of
Post by Alan Weissman
Post by Alan Weissman
Post by Alan Weissman
Struts/Tiles pages
(though I'm not sure what). What is the best
workaround for this?
Thanks so much,
Alan
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for
faster
Post by Alan Weissman
Post by Alan Weissman
http://search.yahoo.com
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
=== message truncated ===


__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you�re looking for faster
http://search.yahoo.com
Richard Yee
2004-03-02 23:16:24 UTC
Permalink
Try putting a semicolon after your alert() call. It
works for me.

<body onLoad="alert('hi');" .....


-Richard
Post by Alan Weissman
If I do a view source and save the source code, then
load the page from
the file system, the alert() works.
If I use IE to save the page and then load the page
from the file
system, I do not get a full page saved, and though
the alert() is in the
body tag, it is not called.
I have never run into anything like this before.
Though I'm starting to
think this might not be a Struts/Tiles thing.
Any thoughts?
Thanks so much,
Alan
-----Original Message-----
From: Alan Weissman
Sent: Tuesday, March 02, 2004 6:03 PM
To: 'Struts Users Mailing List'
Subject: RE: BODY onLoad Workaround
Hey Mark, could you explain what you mean? I've
tried shutting down
Tomcat and restarting, which shouldn't make a
difference. I can also
verify that onload="alert()" is part of the page by
doing a view
source.
Thanks,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 6:00 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
I guess its possible that the layout isn't getting
reloaded with the
tiles request.
an iframe or an image will do as a quick hack.
<iframe width="0" height="0" src="foo.html" />
Post by Alan Weissman
Thanks Richard for your input. Can you let me
know where you see
Post by Alan Weissman
people
using it? I have an onLoad="alert('body onload')"
on my BODY tag
which
Post by Alan Weissman
resides in my layout and it is not being called.
I also found this, which leads me to believe that
I am not alone in
Post by Alan Weissman
this
problem. I am however, not able to find where to
download the tag
Post by Alan Weissman
library the page refers to.
http://retep.org/retep/wiki/retep/taglib/common/onload/index.html
Post by Alan Weissman
Post by Alan Weissman
Thanks again,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 5:45 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
Alan,
I don't see any problem with using the BODY onLoad
event handler. I also searched on Google and found
several instances where others are using it
without
Post by Alan Weissman
any problems. What does your code look like? What
happens when you do a view/source in the browser?
Have
Post by Alan Weissman
you tried using Netscape and looking at the
JavaScript
Post by Alan Weissman
console?
-Richard
Post by Alan Weissman
Hey everyone -
So I have a Struts/Tiles page that I
need to have a
Javascript function called on when the page
loads.
Post by Alan Weissman
Post by Alan Weissman
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
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for
faster
Post by Alan Weissman
http://search.yahoo.com
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you�re looking for faster
http://search.yahoo.com
Alan Weissman
2004-03-02 23:19:26 UTC
Permalink
Unfortunately, this does not change the behavior.

Would it be helpful or just ridiculous for me to post my page? It's
probably about 1000 lines long.

-----Original Message-----
From: Richard Yee [mailto:***@yahoo.com]
Sent: Tuesday, March 02, 2004 6:16 PM
To: Struts Users Mailing List
Subject: RE: BODY onLoad Workaround

Try putting a semicolon after your alert() call. It
works for me.

<body onLoad="alert('hi');" .....


-Richard
Post by Alan Weissman
If I do a view source and save the source code, then
load the page from
the file system, the alert() works.
If I use IE to save the page and then load the page
from the file
system, I do not get a full page saved, and though
the alert() is in the
body tag, it is not called.
I have never run into anything like this before.
Though I'm starting to
think this might not be a Struts/Tiles thing.
Any thoughts?
Thanks so much,
Alan
-----Original Message-----
From: Alan Weissman
Sent: Tuesday, March 02, 2004 6:03 PM
To: 'Struts Users Mailing List'
Subject: RE: BODY onLoad Workaround
Hey Mark, could you explain what you mean? I've
tried shutting down
Tomcat and restarting, which shouldn't make a
difference. I can also
verify that onload="alert()" is part of the page by
doing a view
source.
Thanks,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 6:00 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
I guess its possible that the layout isn't getting
reloaded with the
tiles request.
an iframe or an image will do as a quick hack.
<iframe width="0" height="0" src="foo.html" />
Post by Alan Weissman
Thanks Richard for your input. Can you let me
know where you see
Post by Alan Weissman
people
using it? I have an onLoad="alert('body onload')"
on my BODY tag
which
Post by Alan Weissman
resides in my layout and it is not being called.
I also found this, which leads me to believe that
I am not alone in
Post by Alan Weissman
this
problem. I am however, not able to find where to
download the tag
Post by Alan Weissman
library the page refers to.
http://retep.org/retep/wiki/retep/taglib/common/onload/index.html
Post by Alan Weissman
Post by Alan Weissman
Thanks again,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 5:45 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
Alan,
I don't see any problem with using the BODY onLoad
event handler. I also searched on Google and found
several instances where others are using it
without
Post by Alan Weissman
any problems. What does your code look like? What
happens when you do a view/source in the browser?
Have
Post by Alan Weissman
you tried using Netscape and looking at the
JavaScript
Post by Alan Weissman
console?
-Richard
Post by Alan Weissman
Hey everyone -
So I have a Struts/Tiles page that I
need to have a
Javascript function called on when the page
loads.
Post by Alan Weissman
Post by Alan Weissman
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
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for
faster
Post by Alan Weissman
http://search.yahoo.com
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-***@jakarta.apache.org
For additional commands, e-mail: struts-user-***@jakarta.apache.org
Alan Weissman
2004-03-02 23:22:27 UTC
Permalink
I have to head home as its late here in NYC. Thanks to everyone for
your help. I am going to try to simplify my (incredibly complicated)
page in the morning and if I still have a problem I hope to at least be
able to provide a simplified example. But hopefully I'll be able to
share the cause with you :)

Thanks again,
Alan

-----Original Message-----
From: Alan Weissman [mailto:***@nyc.yamaha.com]
Sent: Tuesday, March 02, 2004 6:19 PM
To: 'Struts Users Mailing List'
Subject: RE: BODY onLoad Workaround

Unfortunately, this does not change the behavior.

Would it be helpful or just ridiculous for me to post my page? It's
probably about 1000 lines long.

-----Original Message-----
From: Richard Yee [mailto:***@yahoo.com]
Sent: Tuesday, March 02, 2004 6:16 PM
To: Struts Users Mailing List
Subject: RE: BODY onLoad Workaround

Try putting a semicolon after your alert() call. It
works for me.

<body onLoad="alert('hi');" .....


-Richard
Post by Alan Weissman
If I do a view source and save the source code, then
load the page from
the file system, the alert() works.
If I use IE to save the page and then load the page
from the file
system, I do not get a full page saved, and though
the alert() is in the
body tag, it is not called.
I have never run into anything like this before.
Though I'm starting to
think this might not be a Struts/Tiles thing.
Any thoughts?
Thanks so much,
Alan
-----Original Message-----
From: Alan Weissman
Sent: Tuesday, March 02, 2004 6:03 PM
To: 'Struts Users Mailing List'
Subject: RE: BODY onLoad Workaround
Hey Mark, could you explain what you mean? I've
tried shutting down
Tomcat and restarting, which shouldn't make a
difference. I can also
verify that onload="alert()" is part of the page by
doing a view
source.
Thanks,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 6:00 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
I guess its possible that the layout isn't getting
reloaded with the
tiles request.
an iframe or an image will do as a quick hack.
<iframe width="0" height="0" src="foo.html" />
Post by Alan Weissman
Thanks Richard for your input. Can you let me
know where you see
Post by Alan Weissman
people
using it? I have an onLoad="alert('body onload')"
on my BODY tag
which
Post by Alan Weissman
resides in my layout and it is not being called.
I also found this, which leads me to believe that
I am not alone in
Post by Alan Weissman
this
problem. I am however, not able to find where to
download the tag
Post by Alan Weissman
library the page refers to.
http://retep.org/retep/wiki/retep/taglib/common/onload/index.html
Post by Alan Weissman
Post by Alan Weissman
Thanks again,
Alan
-----Original Message-----
Sent: Tuesday, March 02, 2004 5:45 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
Alan,
I don't see any problem with using the BODY onLoad
event handler. I also searched on Google and found
several instances where others are using it
without
Post by Alan Weissman
any problems. What does your code look like? What
happens when you do a view/source in the browser?
Have
Post by Alan Weissman
you tried using Netscape and looking at the
JavaScript
Post by Alan Weissman
console?
-Richard
Post by Alan Weissman
Hey everyone -
So I have a Struts/Tiles page that I
need to have a
Javascript function called on when the page
loads.
Post by Alan Weissman
Post by Alan Weissman
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
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for
faster
Post by Alan Weissman
http://search.yahoo.com
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-***@jakarta.apache.org
For additional commands, e-mail: struts-user-***@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-***@jakarta.apache.org
For additional commands, e-mail: struts-user-***@jakarta.apache.org
Alexander Craen
2004-03-02 22:53:06 UTC
Permalink
Hi Alain,

I have used the body onload successfully

http://order.scarlet.be/order/adsl/start.do?language=nl&regcode=PIBUS-WS&accode=AcUjjdIK&product=One

Using it quite often...
I dont have the struts source code here at home... but if you want it I
could look into it tomorrow at work..

grtz
Alexander Craen


----- Original Message -----
From: "Richard Yee" <***@yahoo.com>
To: "Struts Users Mailing List" <struts-***@jakarta.apache.org>
Sent: Tuesday, March 02, 2004 11:44 PM
Subject: Re: BODY onLoad Workaround
Post by Richard Yee
Alan,
I don't see any problem with using the BODY onLoad
event handler. I also searched on Google and found
several instances where others are using it without
any problems. What does your code look like? What
happens when you do a view/source in the browser? Have
you tried using Netscape and looking at the JavaScript
console?
-Richard
Post by Alan Weissman
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
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster
http://search.yahoo.com
---------------------------------------------------------------------
Alan Weissman
2004-03-02 22:58:40 UTC
Permalink
Thanks everyone for all your attention to this. Now I'm really confused
because I am positive my event isn't being called. Here is the source
to my layout page. Pages that use this layout do not get any alert box
popping up.

Thanks again,
Alan

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<html>

<head>

<script language="JavaScript" src="js_css/javaScript.js"
type="text/javascript"> </script>

<title><tiles:getAsString name="title"/></title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"
/>

</head>

<body onload="alert()" marginwidth="0" marginheight="0" leftmargin="0"
topmargin="0" bgcolor="#FFFFFF">

<table width="690" border="0" cellpadding="0" cellspacing="0"><tr><td>

<table width="690" border=0 cellpadding=0 cellspacing=0>
<tr>
<td>
<tiles:get name="header"/>
</td>
</tr>
<tr>
<td>
<tiles:get name="nav"/>
</td>
</tr>
<tr>
<td>
<tiles:insert attribute="body"/>
</td>
</tr>
<tr>
<td>
<tiles:get name="footer"/>
</td>
</tr>
</table>

</td>
</tr>

</body>
</html>



-----Original Message-----
From: Alexander Craen [mailto:***@netural.be]
Sent: Tuesday, March 02, 2004 5:53 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround

Hi Alain,

I have used the body onload successfully

http://order.scarlet.be/order/adsl/start.do?language=nl&regcode=PIBUS-WS
&accode=AcUjjdIK&product=One

Using it quite often...
I dont have the struts source code here at home... but if you want it I
could look into it tomorrow at work..

grtz
Alexander Craen


----- Original Message -----
From: "Richard Yee" <***@yahoo.com>
To: "Struts Users Mailing List" <struts-***@jakarta.apache.org>
Sent: Tuesday, March 02, 2004 11:44 PM
Subject: Re: BODY onLoad Workaround
Post by Richard Yee
Alan,
I don't see any problem with using the BODY onLoad
event handler. I also searched on Google and found
several instances where others are using it without
any problems. What does your code look like? What
happens when you do a view/source in the browser? Have
you tried using Netscape and looking at the JavaScript
console?
-Richard
Post by Alan Weissman
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
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster
http://search.yahoo.com
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-***@jakarta.apache.org
For additional commands, e-mail: struts-user-***@jakarta.apache.org
Mark Lowe
2004-03-02 23:02:27 UTC
Permalink
view the source..
Post by Alan Weissman
Thanks everyone for all your attention to this. Now I'm really confused
because I am positive my event isn't being called. Here is the source
to my layout page. Pages that use this layout do not get any alert box
popping up.
Thanks again,
Alan
<html>
<head>
<script language="JavaScript" src="js_css/javaScript.js"
type="text/javascript"> </script>
<title><tiles:getAsString name="title"/></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"
/>
</head>
<body onload="alert()" marginwidth="0" marginheight="0" leftmargin="0"
topmargin="0" bgcolor="#FFFFFF">
<table width="690" border="0" cellpadding="0" cellspacing="0"><tr><td>
<table width="690" border=0 cellpadding=0 cellspacing=0>
<tr>
<td>
<tiles:get name="header"/>
</td>
</tr>
<tr>
<td>
<tiles:get name="nav"/>
</td>
</tr>
<tr>
<td>
<tiles:insert attribute="body"/>
</td>
</tr>
<tr>
<td>
<tiles:get name="footer"/>
</td>
</tr>
</table>
</td>
</tr>
</body>
</html>
-----Original Message-----
Sent: Tuesday, March 02, 2004 5:53 PM
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround
Hi Alain,
I have used the body onload successfully
http://order.scarlet.be/order/adsl/start.do?language=nl&regcode=PIBUS-
WS
&accode=AcUjjdIK&product=One
Using it quite often...
I dont have the struts source code here at home... but if you want it I
could look into it tomorrow at work..
grtz
Alexander Craen
----- Original Message -----
Sent: Tuesday, March 02, 2004 11:44 PM
Subject: Re: BODY onLoad Workaround
Post by Richard Yee
Alan,
I don't see any problem with using the BODY onLoad
event handler. I also searched on Google and found
several instances where others are using it without
any problems. What does your code look like? What
happens when you do a view/source in the browser? Have
you tried using Netscape and looking at the JavaScript
console?
-Richard
Post by Alan Weissman
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
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster
http://search.yahoo.com
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
McCormack, Chris
2004-03-03 08:56:48 UTC
Permalink
I use onLoad="blah()" with tiles perfectly fine.

The simplest solution in your case, would be to go to the foot of your jsp and insert

<script language="javascript">
doSomething();
</script>

just before the </html> tag.

Chris

-----Original Message-----
From: Richard Yee [mailto:***@yahoo.com]
Sent: 02 March 2004 22:45
To: Struts Users Mailing List
Subject: Re: BODY onLoad Workaround


Alan,
I don't see any problem with using the BODY onLoad
event handler. I also searched on Google and found
several instances where others are using it without
any problems. What does your code look like? What
happens when you do a view/source in the browser? Have
you tried using Netscape and looking at the JavaScript
console?

-Richard
Post by Alan Weissman
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
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-***@jakarta.apache.org
For additional commands, e-mail: struts-user-***@jakarta.apache.org


***********************************************
This e-mail and its attachments are confidential
and are intended for the above named recipient
only. If this has come to you in error, please
notify the sender immediately and delete this
e-mail from your system.
You must take no action based on this, nor must
you copy or disclose it or any part of its contents
to any person or organisation.
Statements and opinions contained in this email may
not necessarily represent those of Littlewoods.
Please note that e-mail communications may be monitored.
The registered office of Littlewoods Limited and its
subsidiaries is 100 Old Hall Street, Liverpool, L70 1AB.
Registered number of Littlewoods Limited is 262152.
************************************************
James MacKenzie
2004-03-03 09:42:57 UTC
Permalink
I had this problem but I just used a tiles tag from the tiles page.

In my page which brings in the Body tag;

<BODY <tiles:getAsString name = "onload"/>>
From the calling page eg...
<tiles:put name="onload" value = "onload=\"xcSet('UserMenu', 'xc');\""/>

Hope this helps
Joe Germuska
2004-03-03 14:55:25 UTC
Permalink
Post by Alan Weissman
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?
You've gotten a number of answers that may have already helped you;
none, however, are in the context of the challenge we met with tiles
and onload handlers. In our tilesets, we usually have the "<body>"
tags in a shared file, while the "meat" of the page which might
require an onload hander is loaded from a different JSP. We didn't
always have an onload handler, so we didn't know what to put in the
shared tile page which included the body tags.

For a while, we used a solution like one posted here, where we just
defined the onload handler as another tile attribute, and then could
set it (or leave it blank) for each tiles definition as necessary.

Since then, though, I've realized that because Javascript functions
are objects, you can actually assign the onload handler in
javascript...


function myHandler { ... }
document.onload = myHandler;

This seems tidier than having to use a tiles attribute.

Joe
--
Joe Germuska
***@Germuska.com
http://blog.germuska.com
"Imagine if every Thursday your shoes exploded if you tied them
the usual way. This happens to us all the time with computers, and
nobody thinks of complaining."
-- Jef Raskin
Continue reading on narkive:
Search results for 'BODY onLoad Workaround' (Questions and Answers)
3
replies
Problem with onLoad and javascript?
started 2010-06-19 13:42:51 UTC
programming & design
Loading...