this solution (using async) is a hack, but it works:
<p:commandButton id="executeButton" action="#{myBean.longOperation}"
async="true" process="@form" value="start import"
onclick="progress.start()" global="false" />
<br />
<p:progressBar ajax="true" widgetVar="progress" value="#{myBean.progress}"
labelTemplate="{value}%" styleClass="animated" global="false" />
<br />
<p:outputPanel id="result" autoUpdate="true">
<h:outputText value="#{myBean.message}" />
</p:outputPanel>
with this kind of bean
@ManagedBean
@ViewScoped
public class MyBean implements Serializable
{
private static final long serialVersionUID = 1L;
private double progress = 0d;
private String message = "ready";
public String longOperation() throws InstantiationException, IllegalAccessException
{
for(int i = 0; i < 100; i++)
{
// simulate a heavy operation
progress++;
message = "processing [" + i + "]";
Thread.sleep(1000);
}
message = "completed";
return "result";
}
public double getProgress()
{
return progress;
}
public void setProgress(double progress)
{
this.progress = progress;
}
public String getMessage()
{
return message;
}
public void setMessage(String message)
{
this.message = message;
}
}