Question

I have a web page which allows the user to carry out various operations that in turn modify the database. Also, this web application needs to keep track of various fields in database that keep changing with time. Is refreshing the page every few seconds the best possible way to implement this? For example, if there is a long list on the page requiring scrolling, it is hard to view the list since the page keeps resetting due to the refresh. I know, there are ways to retain the position of the scroll. But, could I use something more efficient?

Was it helpful?

Solution

Use AJAX with timer.Using this we can refresh the particular part in the page.

OTHER TIPS

Place it under head tag

<meta http-equiv="refresh" content="5">

This will refresh page every after 5 seconds.

For other option refer link text

This task is very easy use following code in html header section

<head> <meta http-equiv="refresh" content="30" /> </head>

It will refresh your page after 30 seconds.

Short answer is NO. YOu can use ajax to update the necessary components. This reduces the load time and keeps your page from resetting.

I think you need something similar to Reverse AJAX now popularly known as Comet. It is server pushing the data to the client instead of browser polling the data from the server/database. http://en.wikipedia.org/wiki/Comet_(programming) has a good introduction. There are already many frameworks (e.g. DWR, ICEFaces) that support this pattern.

AJAX with a Timer

Without going into too much detail, in general you might want to consider generating your HTML dynamically, using Javascript, in an Ajax-style manner. It's considerably more challenging to do right, but it's the right way to go from a user-experience perspective.

Check out the Yahoo user-interface library for guidance and assistance -- it does make things a good deal easier than trying to do everything by hand.

That sounds like a functionality that would be better suited in a Flash or Silverlight application. Using an elaborate AJAX solution might be a bit more efficient than your but the reality is that web pages make a terrible medium for live content.

I think that the following is a good solution with the refresh command in the header.

When you call the httpSuccess function try to use this:

server.httpSuccess("text/html","Refresh: 30\r\n");

if you want to autorefresh the whole page,use meta html tag in the page header.but it better to autoresh the specified part of the page using AJAX to avoid the elasticity of loading time

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top