Poll Component
1. Create model part with Employees table
2. Create a page employees.jspx
3. Drag and drop employeesVO instance from data control as table.
4. Now drag and drop poll component on to the page (anywhere in the page)
5.
6. To refresh our table we need to re execute our query, to do this firstly we need to go to the page definition of our page, from the binding section click the green + sign ,and select action binding.
7.
8. Select poll from structure window and in the property inspector give interval (by default it is 5000 milli sec)
9. Select pollListener -> edit and create managed bean.
10.
11. Write this method to refresh the table.
public void refreshEmployeestable(PollEvent pollEvent) {
// Add event code here...
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
OperationBinding operationBinding = bindings.getOperationBinding("Execute");
Object result = operationBinding.execute();
}
12. Select table and give poll id as partial trigger to it.
13.
14. Run the application.
15. For every 5 seconds it will be refreshed.
16. Change the data in the database table (eg- salary of any employee)and see on the browser,it will be refreshed automatically..
Comments
Post a Comment