My application lets the user to type text in the message field and when he is typing, at htat time it has to allow the admin to see what is being typed in a different console.
for this I need to send data periodically to the 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 I process them in process() method of the clockBean managed 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); }
//getters setters & rest of the code
currently I have my bean scope as ViewScopedand I am getting null values for the 2 fields when the poll runs every 20 seconds. How can I get the name and msg property values when the poll runs in a given time interval? is there any better approach to resolving this issue?
@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); } //getters setters & rest of the code
– Sanath Jun 21 '11 at 05:35