Progresssbar ajax, how to use

UI Components for JSF
Post Reply
hmrupp
Posts: 9
Joined: 14 Dec 2010, 13:29

15 Dec 2010, 13:30

primefaces-2.2.RC2
on JBoss 6 M5 (Mojarra 2.0)

Code: Select all

<p:progressBar id="progressBar" ajax="true" value="#{FeedbackReceiverBean.percent}"  style="width:300px" />
I see from the logs that FeedbackReceiverBean.percent is being updated with int values between 0 and 100. The progress bar won't move.
From the user guide
Ajax Progress
Ajax mode is enabled by setting ajax attribute to true, in this case the value defined on a
JSF backing bean is retrieved peridically and used to update the progress.
<p:progressBar ajax="true" value="#{progressBean.progress">
public class ProgressBean {
private int progress;
//getters and setters
}
this would be exactly what I need. Am I missing something? Do I need other components on the page to make this work?
I have seen from other examples that the progress bar works with pbAjax.start() in the onClick event of the command button.
But this is not what I need. I need a component that asynchronously shows the state of a server component each time the user navigates to the page the component is on.

Can this be done with PrimeFaces?

complete page:

Code: Select all

<!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:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      >

	<h:head>
		<title></title>
		
	</h:head>
	<h:body>
	<h:form id="form">
		<h1>DSDE Prototype</h1>
		<p>
			Message:<br />
			<h:inputTextarea value="#{UploadBean.messageText}" rows="5" />
		</p>
		<p>
		
			<p:commandButton action="#{UploadBean.doSendMessage}" value="Send"  onclick="pbAjax.cancel();startButton.disable();" widgetVar="startButton" disabled="#{UploadBean.startButtonDisabled}"/>
		</p>
		<p>
			<p:progressBar id="progressBar" ajax="true" value="#{FeedbackReceiverBean.percent}"  style="width:300px" />
		</p>
		<p>
			<h:link outcome="secondPage" value="Something Else"></h:link>
		</p>
		<p>
			<h:panelGrid columns="2">
				<h:outputLabel value="Used ConnectionFactory" />
				<h:outputText value="#{UploadBean.connectionFactoryName}" />
				<h:outputLabel value="Used Queue" />
				<h:outputText value="#{UploadBean.queueName}" />
			</h:panelGrid>
		</p>
	</h:form>
	</h:body>
</html>

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 49 guests