aspose file tools*
The moose likes JSP and the fly likes How to Display time in JSP without refreshing page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to Display time in JSP without refreshing page" Watch "How to Display time in JSP without refreshing page" New topic
Author

How to Display time in JSP without refreshing page

Deepak Lohar
Greenhorn

Joined: Nov 13, 2002
Posts: 14
Hi all,
I am trying to achieve the following funtionality in my JSP page:
=========================================================
I want the time to be in number of seconds, like when the seconds is incrementing
as 1, 2 , 3 .....58,59,60...after 60 i want it continue as 61, 62 and so on.
I am able to acheive this through JavaScript , but i simply dont want to use JavaScript.
Secondly I want to display this time in Seconds on the JSP page without refreshing the page,
i mean i dont want to call the refresh on the page but the variable holding the time in seconds
should be updated and should increment by a second and should be diplayed on the page,
for example 1, 2 , 3......59, 60 , 61 and so on.
Even this i could achieve through JavaScript , again i dont want to use JavaScript.
I want to achieve the above functionality by Pure JSP code.
--------------------------------------
Actually i am creating a loop based on number of seconds, and after 12 seconds there is a movie clip to be palyed , then after 15 seconds there is a gif file to be loaded for another 12 seconds and like wise things come and go based on certain intervals of specified number of seconds .
its a simple one like
variable x of type long, is holding the value in seconds
if (x>=01 && x<=15){
// movie clip for 15 sec
}
else if (x>=16 && x<=27){
// gif file for 12 sec
}
else if ( x >=28 && x<=42){
// flash fiel for 15 sec
}
..
...
else if ( x<60 && x<=75){
// movie clip for 15 sec
}
so on and so forth till x reaches 300 seconds
-------------------------------------
any immediate reponse will be of great help
cheers
Deepak


DL
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61419
    
  67


I am able to acheive this through JavaScript , but i simply dont want to use JavaScript.
Secondly I want to display this time in Seconds on the JSP page without refreshing the page,

Well, you're going to have to pick one or the other. To perform this functionality completely on the client side, you'll need Javascript. To perform it on the server side, you need a server hit.
Now, if it's just the master page you want to avoid refreshing, you can create an iframe to show the timestamp and refresh only it.
But other than that, it's Javascript, or an applet, or an ActiveX control, or something along those lines, but you can't do this in "pure JSP" without a server hit each time to update the count.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Deepak Lohar
Greenhorn

Joined: Nov 13, 2002
Posts: 14
Can anybody throw some more light on this topic.
thx
Deepak
[ June 09, 2003: Message edited by: Deepak Lohar ]
Deepak Lohar
Greenhorn

Joined: Nov 13, 2002
Posts: 14
Can Anybody throe some light on how to achieve the above fucntionlaity.
Deepak
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61419
    
  67

Well, which approach do you want to pursue? And given that this is not a JSP question at all, this would be better discussed in the HTML/Javascript forum.
hth,
bear
[ June 09, 2003: Message edited by: Bear Bibeault ]
sunitha reghu
Ranch Hand

Joined: Dec 12, 2002
Posts: 937
Deepak,
Better use Flash and Flash script. Then it will be very easy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Display time in JSP without refreshing page