Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2011
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. package test;
  2.  
  3. import java.io.Serializable;
  4. import javax.faces.bean.ApplicationScoped;
  5. import javax.faces.bean.ManagedBean;
  6. import org.primefaces.context.RequestContext;
  7.  
  8. @ManagedBean(name="globalCounter")
  9. @ApplicationScoped
  10. public class GlobalCounter implements Serializable{
  11.  
  12. private int count;
  13.  
  14. public int getCount() {
  15. return count;
  16. }
  17.  
  18. public void setCount(int count) {
  19. this.count = count;
  20. }
  21.  
  22. public synchronized void increment() {
  23. count++;
  24. RequestContext.getCurrentInstance().push("counter", count);
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement