Solved

Servlet Problem

Posted on 2001-09-10
9
212 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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 20 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

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 automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
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…

827 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