Solved

Servlet Problem

Posted on 2001-09-10
9
217 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ecommerce options and opinions... 6 64
Spell check for online editor 7 80
Visual Studio Web Development - HTML 7 76
wysiwyg - good free programs 3 69
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…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…

730 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