diff --git a/src/main/java/net/bootsfaces/demo/PollDemoBean.java b/src/main/java/net/bootsfaces/demo/PollDemoBean.java index 83e4d67b..a1872a54 100644 --- a/src/main/java/net/bootsfaces/demo/PollDemoBean.java +++ b/src/main/java/net/bootsfaces/demo/PollDemoBean.java @@ -2,17 +2,18 @@ import java.io.Serializable; import java.util.Date; - import javax.faces.bean.ManagedBean; -import javax.faces.bean.RequestScoped; +import javax.faces.bean.ViewScoped; import javax.faces.event.ActionEvent; -@RequestScoped +@ViewScoped @ManagedBean public class PollDemoBean implements Serializable { private static final long serialVersionUID = 1L; private int counter=0; + + private boolean stop; public Date getCurrentTime() { return new Date(); } @@ -24,6 +25,14 @@ public void setCounter(int counter) { this.counter = counter+1; } + public boolean isStop() { + return stop; + } + + public void setStop(boolean stop) { + this.stop = stop; + } + public void listener(ActionEvent event) { // System.out.println("Poll called me"); } diff --git a/src/main/webapp/forms/PollAttributes.xhtml b/src/main/webapp/forms/PollAttributes.xhtml index ceb4326e..e6c05e96 100644 --- a/src/main/webapp/forms/PollAttributes.xhtml +++ b/src/main/webapp/forms/PollAttributes.xhtml @@ -47,11 +47,6 @@
- <b:poll />
- refreshes a part of the screen periodically. It can also call an action
or an actionListener
.
-
Prior to BootsFaces 1.1.2, the attributes update
and execute
where simply passed to the HTML code.
- Since 1.1.2, they are evaluated by the advanced search expression engine of BootsFaces, as they should. However, this may
- break programs relying on the bug (such as this showcase).
You can access the JavaScript API by setting the widgetVar
attribute. This attribute is the name of the JavaScript
- object implementing <b:poll />
on the client side. Currently, the public API consists of a single funktion:
widgetVar.stop()
allows you to stop polling from JavaScript.<b:poll />
is inside the region it updates, you have to set the attribute once="true"
. Otherwise,
- <b:poll />
is initialized over and over again and starts to send more and more polls until your server is saturated.
- Attribute | -Default value | -Description | -
---|---|---|
action | -none | -Calls a JSF bean method and initiates a navigation. | -
actionListener | -none | -Calls an action listener in the JSF bean. | -
execute | -@none | -Which input fields are to be sent? | -
interval | -1000 | -How often is the poll action to be called? Denotes the number of milliseconds between polls. | -
once | -false | -If true, the poll is called only once. | -
update | -@form | -Which region of the screen is to be updated? | -
stop | -false | -If true, the poll will stop. | -
widgetVar | -none | -Optional widget variable to access the datatable widget in JavaScript code. | -
Attribute | +Default value | +Description | +
---|---|---|
action | +none | +Calls a JSF bean method and initiates a navigation. | +
actionListener | +none | +Calls an action listener in the JSF bean. | +
execute | +@none | +Which input fields are to be sent? | +
interval | +1000 | +How often is the poll action to be called? Denotes the number of milliseconds between polls. | +
update | +@form | +Which region of the screen is to be updated? | +
stop | +false | +If true, the poll will stop. | +
widgetVar | +none | +Optional widget variable to access the datatable widget in JavaScript code. | +