Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JSP
Not SetInterval() is applicable for scriplet
satyaprasad veeramsetti
Greenhorn
Posts: 28
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi Friends,
I want to display message for every five seonds in Server side using scriplet. For this, i have added below code.
<html>
<head>
<script type="text/javascript">
setInterval(function(){
show();
}, 5000);
function show(){
<%
System.out.println("Five Seconds");
%>
}
</script>
</head>
<body>
</body>
</html>
But it is showing the message "Five Seconds" only once. if we put alert() inside show() method, i displays alert message for every 5 seconds.
i.e.
<script type="text/javascript">
setInterval(function(){
show();
}, 5000);
function show(){
<%
System.out.println("Five Seconds");
%>
}
</script>
I dont now the reason. Please help me.
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You cannot mix
JSP
code with JavaScript. Please read
this article
to understand how JSP operates and why this is impossible.
If you want to communicate with the server via JavaScript, you'll need to use Ajax.
So, what is it that you are actually trying to accomplish?
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Alert and setTimeout methods behaving differently in IE and Safari
running servlet after the browser is closed
Javascript function trying to access Scriptlet value
Undefined Array Problem
How to edit javascript in firefox 3.6
More...