?
Solved

Servlet Problem

Posted on 2001-09-10
9
Medium Priority
?
226 Views
Last Modified: 2010-04-07
I'm working on Servlet.I want to develop a screen in sucha manner that it refreshes automatically after a specified period of time(suppose 60 sec.) with new data from the database,in case if user does'nt click on "next" button in time.How can i achieve this task in servlets?
0
Comment
Question by:sandeep2k
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 19

Expert Comment

by:cheekycj
ID: 6490736
You have to do this using JavaScript on the client side... as the servlet has no control over the page once it is presented to the user's browser.

CJ
0
 

Author Comment

by:sandeep2k
ID: 6492320
ok!! then can you please let me know how can i encorporate javascript code on servlets.?
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6493643
Well,
  Are you displaying the HTML via a Servlet (out.print) or JSPs?

  I can write a JavaScript that will start a timer.. and after 60 seconds... it will expire and refresh the page (the servlet should handle providing the new data).. the timer will only expire if the page still exists (i.e. next or any button wasn't pressed for that time)

Is that what you want?

CJ
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 

Author Comment

by:sandeep2k
ID: 6503086
yes!!and also please let me know how can i encorporate javascript code with in servlet code.as i am using servlet(out.println) for displaying HTML page.
0
 
LVL 19

Accepted Solution

by:
cheekycj earned 80 total points
ID: 6505575
Using JavaScript:
<head>
<script language="JavaScript"><!--
function executeTimer() {
if (document.images)
    location.reload(true); // forces a reload from the server
else
    location.href = location.href;  // just reloads the page
}
//--></script>

</head>

<body onLoad="tID = setTimeout('executeTimer()',1000*60)"

OR you can try this meta refresh:
Assuming the name of your servlet/jsp is:
myPage.jsp
<meta http-equiv="refresh" content="60 ;url=myPage.jsp">

CJ
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7241904
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
   In the absence of responses, I may recommend DELETE unless it is clear
   to me that it has value as a PAQ.  Silence = you don't care
</note>

Cd&

0
 
LVL 19

Expert Comment

by:cheekycj
ID: 7243877
IMHO, I provided a valid solution, so if the pts are awarded, they should go to me.

CJ
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7864349
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
points to cheekycj

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
0
 

Expert Comment

by:DigitalXtreme
ID: 7954063
answer force-accepted per recommendation

DigitalXtreme
CS Moderator
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When deciding to adopt any help desk solutions many factors should be explored before taking decisions. This will change from business to another but in general there are some kind of rule of thumb. Here are some quick tips: Do we need only ticket…
Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
Suggested Courses
Course of the Month17 days, 6 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question