My application allows the user to enter text in the message field, and when he types, at htat time, he should let the administrator see what is being dialed in another console.
for this I need to periodically send data to a managed bean and from there to the business layer.
<h:form> Name : <h:inputText id="name" value="#{clockBean.name}"/> Message: <h:inputText id="age" value="#{clockBean.msg}"/> <a4j:poll id="poll" interval="20000" enabled="#{clockBean.enabled}" action="# {clockBean.process}" render="clock,counter"/> <a4j:log/> </h:form>
I have managedBean properties for name and msg, and I need to access the name and msg properties and send them to the business layer when processing them in process () of the clockBean method controlled by Bean.
@ManagedBean @ViewScoped public class ClockBean implements Serializable{ private string msg; private string name; private boolean enabled; public void process(){ System.out.println("timer event calling *** - msg is "+msg+" : name is "+name); }
I currently have a bean scope like ViewScopedand. I get zero values ββfor two fields when polling is done every 20 seconds. How can I get the values ββof the name and msg properties when the polling is done at a given time interval? Is there a better approach to solving this problem?
source share