Solved

Servlet Problem

Posted on 2001-09-10
9
202 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…

746 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now