As above, can JSP do "live feed", as in if the DB has newly added items, a display page will auto add this item without polling the DB.
Or this has to be done other language?

Thanks in advance.

7 Years
Discussion Span
Last Post by ~s.o.s~

JSP is based on http. Http is a request/response mechanism.

Whether it is possible at all depends on whether the database presents a mechanism by which it can send automatic information about updates to listening clients.
Personally I'd never do such a thing. A polling mechanism works a lot better and is less of a drain on system resources.


If I use polling mechanism, won't it be more of a drain to system resource if I poll every second?

Can use AJAX?


As already mentioned, HTTP is a request/response protocol; what this implies is that the server can push updates/send a response only when requested. So you can two choices to update your data on screen:
- Use long lived connections to implement server push. The way this normally works is that the initial request which loads the data doesn't close the connection.
- Use polling as already mentioned.

Both approaches end up consuming resources. Server push keeps all the connections occupied which might lead to the server running out of connections if a lot of clients are using your application. Polling leads to the server being bombarded with constant requests even when there is no data which can be pushed to the client.

You might want to review your requirements and decide which approach suits you best. Here is an interesting read about the different async technologies BTW.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.