I want to display a popup window whenever an event (say some timeout occurs at server) occurs. For the popup window I am using jQuery in JSF pages (JSF 2.0). How do I call a jQuery function from a service method of a JSF ManagedBean?
Actually it’s like reverse of AJAX instead of client making periodic calls to the server. I want the server to notify the client whenever some event occurs. Not all the users will have notifications all the time. I want to reduce the network calls. The server tells the client from his side that “Mr. X, this is a notification for you “.
Instead of trying to tie Java and jQuery together, simply define your jQuery call such that, unless it gets a response within a certain time frame, it will display a “server is being slow” message, or some other appropriate alert.
In other words (example):