Hi,
here i will list my whole sample code.
My problems are:
1. The progressbar couldn't be set to the given maxValue (5)
2. The progressbar is updated after the save method is finished, unlike the (ajax-polled) outputtext
BeanCode: Select all
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.event.ActionEvent;
/*
* customer profile
*/
@ManagedBean
@SessionScoped
public class Customer {
private int count;
public int getCount() throws Exception{
return count;
}
public void setCount(int count) {
this.count = count;
}
public String save() throws Exception{
//return "/showCustomer.xhtml?link=hallo";
for(int i=0; i<4;i++){
Thread.sleep(3000);
setCount(i);
}
return null;
}
public void increment(ActionEvent actionEvent) {}
}
XHTML
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<title>Customer</title>
</h:head>
<body>
<h:form id="form">
<p:progressBar widgetVar="pbAjax" ajax="true" value="#{customer.count}" minValue="0" maxValue="5" step="1" interal="1"/>
<h:outputText id="cntId" value="Count: #{customer.count}"/>
<h:commandButton id="save" action="#{customer.save}" value="Save"/>
<p:poll actionListener="#{customer.increment}" update="cntId" />
</h:form>
</body>
</html>
the showcase links aren't working for me. They're unreachable... but my sample code isn't big and should explain what i want.
thank you!!!
maxpade