users@woodstock.java.net

Re: determinate progressBar refresh question

From: Animesh Sahay <animesh.sahay_at_gmail.com>
Date: Wed, 19 Mar 2008 17:10:54 +0530

On 3/19/08, Vanessa Black <Vanessa.Black_at_sun.com> wrote:
>
>
>
> Hi folks,
>
> I have a question about implementing the determinate progress bar (I'm
> using WS 4.1.1). I notice that with my bean in request scope it gets
> reinitialized at every progressBar refresh. I looked at the progressBar
> example on the examples page that you host and I see that in the example,
> the bean's progress field gets incremented. I don't see how the updates to
> the progress field stick if the bean is getting initialized at every
> refresh. Could you clarify this for me?
Backing bean for the progressbar example has the session scope.
<managed-bean>
        <description>The backing bean for the ProgressBar example</description>
        <managed-bean-name>ProgressBarBean</managed-bean-name>
<managed-bean-class>com.sun.webui.jsf.example.progressbar.ProgressBarBackingBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>

-Animesh
>
> This error in firebug on every refresh of the progressBar
>
>
> I has no properties
>
> init(Object id=form1:bar1 event=progress)com_sun_faces_aja... (line 1)
> init(XMLHttpRequest channel=[xpconnect wrapped nsIChannel], Object
> id=form1:bar1 event=progress)com_sun_faces_aja... (line 1)
> emptyFunction()prototype.js (line 8)
> emptyFunction(4)prototype.js (line 8)
> emptyFunction()prototype.js (line 8)
> emptyFunction()prototype.js (line 8)
> var __existingDynaFaces__=null;if(typeof
> DynaFaces!="undefined"){__existingDynaF...
>
> Here is my example that I was trying this out on:
>
>
> <webuijsf:form id="form1">
> <webuijsf:markup id="leftmargin" tag="div"
> style="margin:2%">
> This is a progress bar
> <br/> <br/>
> <webuijsf:progressBar id="bar1"
> type="DETERMINATE"
>
> progress="#{determinateProgressBarBean.progress}"
> refreshRate="3000">
> </webuijsf:progressBar>
> <br/> <br/>
> </webuijsf:markup>
> </webuijsf:form>
>
>
>
> Here is the bean in request scope
>
>
>
> package sandbox.progressbar;
>
> /**
> *
> * This bean backs the JSP implementing a determinate progress bar
> */
> public class DeterminateProgressBarBean {
>
> private int progress = 0;
>
> public DeterminateProgressBarBean() {
> initState();
> }
>
> /**
> * This initializes the state of the bean
> */
> void initState() {
> System.out.println("Initing state");
> }
>
> /**
> * This updates the progress by 20% every time it is called
> * @return
> */
> public int getProgress() {
> if (progress < 100) {
> progress += 20;
> if (progress > 100) {
> progress = 100;
> }
> }
> return progress;
> }
>
>
> }
>
>
> Thanks,
>
> Vanessa
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe_at_woodstock.dev.java.net For additional
> commands, e-mail: users-help_at_woodstock.dev.java.net