This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
1. Stateful session bean (lets call this the StatusBean) loads data from a datasource and updates a UIComponent showing a textlabel.
2. I want to implement some kind of timer to check every X second / minutes for new data. If there is then I want to update the UIComponent.
3. I would like to have one single stateless (application or session scoped) bean (lets call this DataCheckBean) doing the polling and notify all active sessionbeans.
Is this possible somehow? What's the best practice for this?
Um, you DO know that the UIComponent only exists while someone's actually doing an HTTP request/response, don't you? HTTP is not like client/server where the resources and connections exist all the time.
An IDE is no substitute for an Intelligent Developer.
Joined: Jul 08, 2009
Yes indeed, my bad. (normally not a webprogrammer). Then I have a very simple question perhaps. How to poll the StatusBean every x seconds from the client side? I want to check if the status changed via Ajax, if it did then I want to re-render the component. Can I do this using the f:ajax tag? If so how, I can only se events like mouseout in the f:ajax tag, is there some other way to achieve this?