views:

8

answers:

1

I am using Struts2, Spring and Hibernate. Can someone please help me to update the webpage automatically when there is an DB update. Update to DB may not be from application as well, it may be directly to DB. So I need to know the DB update changes and other is how to poll the changes to web page.

Thanks in advance

A: 

I don't know if I completely understand what you're asking for. But as I see it, what you're asking for is a way to update a web page, without refreshing (and without knowing when to refresh), that means using Push. You can achieve that in so many different ways. I'm just going to outline how I would do it:

1 - Implement a Comet Server. I would suggest Atmosphere

2 - In that server implement a @Broadcast method.

3 - In the Comet Server also implement a thread that just checks for updates on the database and when found, invoke the broadcast method.

4 - Finally use some kind of subscribe method to the Comet Server. I would suggest using the JQuery library provided by Atmosphere.

As I said, this is just an outline and there are many options to achieve what you need (or what I think you need), this is just one.

1000i1