471,071 Members | 1,234 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

Javascript in a JSP/JSTL page

Hello.

I need insert a piece of javascript code in a JSTL page, that it will
execute always, that is, without events. I use the tag <scriptbut
this make that the web don't load correctly.
Any idea?

May 3 '07 #1
4 6830
Manuel <mf*****@gmail.comwrote:
>Hello.

I need insert a piece of javascript code in a JSTL page, that it will
execute always, that is, without events. I use the tag <scriptbut
this make that the web don't load correctly.
JSTL and JSP run on the server. The result is an HTML page which is
sent to the client. That page may contain Javascript, which will run
on the client.

Javascript that's not part of a function will run when it's
encountered. Something like this:

<script type="text/javascript">
var a;
a = 5;
alert ("a=" + 5);
</script>

will cause a message box to appear as soon as the browser parses it.

--
Tim Slattery
Sl********@bls.gov
http://members.cox.net/slatteryt
May 3 '07 #2
On May 3, 6:22 pm, Tim Slattery <Slatter...@bls.govwrote:
Manuel <mfc1...@gmail.comwrote:
Hello.
I need insert a piece of javascript code in a JSTL page, that it will
execute always, that is, without events. I use the tag <scriptbut
this make that the web don't load correctly.

JSTL and JSP run on the server. The result is an HTML page which is
sent to the client. That page may contain Javascript, which will run
on the client.

Javascript that's not part of a function will run when it's
encountered. Something like this:

<script type="text/javascript">
var a;
a = 5;
alert ("a=" + 5);
</script>

will cause a message box to appear as soon as the browser parses it.

--
Tim Slattery
Slatter...@bls.govhttp://members.cox.net/slatteryt
I know it. But that crash and the web is not loaded correctly and i
don't know why :(

May 3 '07 #3
Manuel <mf*****@gmail.comwrote:
>On May 3, 6:22 pm, Tim Slattery <Slatter...@bls.govwrote:
>Manuel <mfc1...@gmail.comwrote:
>Hello.
>I need insert a piece of javascript code in a JSTL page, that it will
execute always, that is, without events. I use the tag <scriptbut
this make that the web don't load correctly.

JSTL and JSP run on the server. The result is an HTML page which is
sent to the client. That page may contain Javascript, which will run
on the client.

Javascript that's not part of a function will run when it's
encountered. Something like this:

<script type="text/javascript">
var a;
a = 5;
alert ("a=" + 5);
</script>

will cause a message box to appear as soon as the browser parses it.

--
Tim Slattery
Slatter...@bls.govhttp://members.cox.net/slatteryt

I know it. But that crash and the web is not loaded correctly and i
don't know why :(
If the script refers to something that hasn't been loaded yet, it will
fail. Try moving your script block to the end of the HTML page.

--
Tim Slattery
Sl********@bls.gov
http://members.cox.net/slatteryt
May 3 '07 #4
On May 3, 10:07 pm, Tim Slattery <Slatter...@bls.govwrote:
Manuel <mfc1...@gmail.comwrote:
On May 3, 6:22 pm, Tim Slattery <Slatter...@bls.govwrote:
Manuel <mfc1...@gmail.comwrote:
Hello.
I need insert a piece of javascript code in a JSTL page, that it will
execute always, that is, without events. I use the tag <scriptbut
this make that the web don't load correctly.
JSTL and JSP run on the server. The result is an HTML page which is
sent to the client. That page may contain Javascript, which will run
on the client.
Javascript that's not part of a function will run when it's
encountered. Something like this:
<script type="text/javascript">
var a;
a = 5;
alert ("a=" + 5);
</script>
will cause a message box to appear as soon as the browser parses it.
--
Tim Slattery
Slatter...@bls.govhttp://members.cox.net/slatteryt
I know it. But that crash and the web is not loaded correctly and i
don't know why :(

If the script refers to something that hasn't been loaded yet, it will
fail. Try moving your script block to the end of the HTML page.

--
Tim Slattery
Slatter...@bls.govhttp://members.cox.net/slatteryt
well, I call a some function that it is at an external file that is
loaded in the beginning of the webpage. All the ways, I tried with a
simple code that this:

<script type="text/javascript">
alert("hello world");
</script>

I don't understand :(((

May 3 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Michael Alers | last post: by
reply views Thread by SOAP | last post: by
1 post views Thread by Brent Eamer | last post: by
2 posts views Thread by steve | last post: by
dmjpro
reply views Thread by dmjpro | last post: by
dmjpro
1 post views Thread by dmjpro | last post: by
dmjpro
2 posts views Thread by dmjpro | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.