This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
JSF - or for that matter, any J2EE webapp - isn't a "program" that runs. It's an architecture that sits idle until someone makes an HTTP request, whereon it invokes the appropriate application logic and sends a response. At which time it sits idle again until the next request.
There are certain circumstances where a traditional program may be integrated into a webapp, and they are done by spawning threads (typically in a servlet's init() method). But this probably isn't one of them.
If you were hoping to dynamically refresh a page display from a database, it wouldn't help. A web page cannot be "pushed", it can only be "pulled", so you'd need to have the user bring up a web page with some sort of refresh option on it (which causes their browser to send another page request after an interval has expired).
How you update the server's view of the database is another matter. Although a page refresh could get an update database view by counting the time since the last database fetch was done, that may be over-complicating things. In modern-day databases and persistency architectures, often less work will do more for you. By which I mean that instead of attempting to do timed data refreshes, simply make a database query on each page request.
If you are using a sufficiently advanced persistency mechanism, the system will optimize the request such that actual data transfer is only done when the database has changed. You'll get more efficient use of your resources and your code will be less complicated.
Since this can vary depending on what you're working with, it's a good idea to do it the simple way at first and then try optimizing it if/as needed.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: May 13, 2006
"By which I mean that instead of attempting to do timed data refreshes, simply make a database query on each page request."
There is only one page which is fetching the data from the database after every 5 mins. Please give some code snippet so that I can show the real time report to the user. The database is being updated every 2 mins.