How to update UI automatically for any Database changes


Web tier: servlets, JSP, Web frameworks: How to update UI automatically for any Database changes

  1. I have a page (HTML/JSP) wherein I am displaying a table. When the page loads, the table fetches values from the DB and displays the data in tabular format. Now if there is any change in the database (like for example if data of x column and y row is changed), I want the change to be reflected immediately in my UI without a reload/refresh. Any idea how to implement this functionality. Can triggers be sent to the UI from the DB for any updates?? Or can we use Ajax to display dynamic tables?? Or will dojo help... Kindly suggest... Note : I do not want a reload or refresh the page, the data should get updated automatically. Thanks, Preeti
  2. I haven't come across a reliable push model browser update before but what works quite well is use an ajax call to update your table on a periodical basis. PeriodicalExecuter from the prototype.js package is quite useful for this, and look at scriptaculous for the Ajax. Nice and simple to get you going.
  3. Thanks a lot for the reply... I am currently using dojo 0.4 toolkit in my application. Is this implementation possible using dojo...?? Or is is it better to opt for Ajax...??
  4. I think Dojo is just another Ajax/Javascript Framework. Yes you have to implement a polling mechanism using XmlHttp (the original techie term for Ajax), which can create an illusion of content being pushed from the Server. Say you can poll/Invoke a servlet/JSP on the server, and query for any changes in the DB, and if found.. you can update the UI accordingly.
  5. If you use MS SQL Server 2005[ Go to top ]

    FYI, If you are using something like MS SQL Server 2005, their is a facility to have triggers send JMS / Web Service Requests in response to updates / inserts to a table in the database. You could simply have the database post updates to the app server and then poll the app server via ajax for items in a queue of some sort.
  6. Need More Info[ Go to top ]

    Hi, I am still not clear what is the meaning of polling the app server via ajax.If the browser is not sending any request then how is it possible to accept any kind of response?Correct me if my understanding is wrong. We can configure the database triggers but the problem is how the browser will understand this response?