HTTP is a request/response protocol and JSF is built on top of HTTP. What request/response means is that HTTP servers cannot output data (responses) unless a request was made first. There is a strict 1:1 correspondence between requests and responses, and no request may have multiple responses, nor may the server send unsolicited or asynchronous responses.
So in order to get a page refreshed when a database changes, you must design the webpage to be self-requesting. There's an HTML META tag that can cause the user's browser to send a request after a defined time interval has expired. AJAX can do that as well, but you said "page refresh", not "page update", so I'm going for the simpler solution here.
Likewise, the JSF server-side logic is invoked only on request, so a database cannot simply post updates to the data, the JSF logic has to issue a query to the database when the request has been made. Whether it's easier and more efficient to simply make the same SQL request over and over or attempt something fancier depends on your overall app and database infrastructures. Often the overhead for repeated queries is pretty low, since the unchanged data would be in cache either on the DBMS server, in the webapp, or both places.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Apr 01, 2011
Hi Tim, and thank you for your reply.
The problem is, our customer would like fancy solution. I would like to know is it possible to do that kind of refreshing/updating?
In my actual problem, i'd need to update few tables on page after new database update. Can i use ajax with jsf1.2?