Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 19630 invoked from network); 4 Mar 2011 15:39:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Mar 2011 15:39:08 -0000 Received: (qmail 44792 invoked by uid 500); 4 Mar 2011 15:39:07 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 44729 invoked by uid 500); 4 Mar 2011 15:39:07 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 44718 invoked by uid 99); 4 Mar 2011 15:39:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Mar 2011 15:39:07 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [129.177.30.72] (HELO alfons.uib.no) (129.177.30.72) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Mar 2011 15:38:57 +0000 Received: from thoralf.uib.no (smtp.uib.no) [129.177.13.16] by alfons.uib.no for users@myfaces.apache.org with esmtp (Exim 4.69) id 1PvX5P-0002nM-Es; Fri, 04 Mar 2011 16:38:36 +0100 Received: from mail-qw0-f53.google.com [209.85.216.53]:47292 by smtp.uib.no for users@myfaces.apache.org with esmtpsa (Exim 4.69) id 1PvX5O-00084R-UR; Fri, 04 Mar 2011 16:38:35 +0100 Received: by qwc9 with SMTP id 9so1890264qwc.12 for ; Fri, 04 Mar 2011 07:38:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.29.9 with SMTP id o9mr652572qcc.58.1299253113534; Fri, 04 Mar 2011 07:38:33 -0800 (PST) Received: by 10.229.187.85 with HTTP; Fri, 4 Mar 2011 07:38:33 -0800 (PST) In-Reply-To: References: <3150623219871629127@unknownmsgid> <6819536426873199730@unknownmsgid> <-1240845642059190982@unknownmsgid> <4D6FCD79.8080409@gmail.com> <9D8294EE-FB7A-422A-B98E-3C6F6E0CBCBD@gmail.com> <-2539163604918875759@unknownmsgid> Date: Fri, 4 Mar 2011 16:38:33 +0100 Message-ID: Subject: Re: Using statusIndicator From: =?ISO-8859-1?Q?H=E5kon_Sagehaug?= To: MyFaces Discussion Content-Type: multipart/alternative; boundary=0016364274c04e3a1f049da9f093 X-checked-clean: by exiscan on alfons X-Scanner: 3598c7bbc4d70dc758610389a9c7da38 http://tjinfo.uib.no/virus.html X-UiB-SpamFlag: NO UIB: -8.9 hits, 8.0 required X-UiB-SpamReport: spamassassin found; -9.0 Message received from UIB 0.0 BODY: HTML included in message X-Virus-Checked: Checked by ClamAV on apache.org --0016364274c04e3a1f049da9f093 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi, So we're trying to implement part of a system, already implemented with icefaces using myfaces and Trinidad. We decided to compare alittle. Iceface= s have Ajax Push, so it makes it "easy" to update clients whenever there are things to update. SO when a user logs in, we're calling tree different web-services in the backend code. In the other application we update after each call to one of the web service saying 1. Got security token 2. got user information 3. got dataset etc All these are separate call to our web-services, and it would be nice to update the user about the events. For the login we don't start a new thread= . Other actions such as adding a dataset, where the user want to fetch one or more files from ftp/http we start a new thread on the server.First the thread sends the requets for adding the dataset to the web service, and get= s back a id. The web service starts a thread for downloading the files, when finished sets the dataset status to complete. In the mean time the thread o= n the web server polls the status of the download with the id given to him. S= o when the Web server thread gets complete from the web service, a message is given to the user. Did that give an okay overview? Just a dumb question, how to enable the poll, setting a positive poll interval? And again thanks for the patience cheers, H=E5kon On 4 March 2011 16:07, Richard Yee wrote: > enable it on the server as a result of pressing the commandButton. can yo= u > answer some of the questions I posed earlier? > If we see the whole picture, then perhaps we can come up with a complete > solution. > > -Richard > > 2011/3/4 H=E5kon Sagehaug > > > Hi > > > > Thanks for the tips and holding out this thread. To kick of the poll d= o > I > > use rendered=3Dtrue/false, it should have had a enable/disable. Or can = I > set > > the interval to 0 or -1. > > > > Cheers, H=E5kon > > > > On 4 March 2011 14:18, Scott O'Bryan wrote: > > > > > Yeah, I agree with Richard now that I know your trying to dynamically > > > update it. The poll components will kick off the AJAX request and > > > your partialTrigger (set to the poll component) will allow the text t= o > > > change. > > > > > > I would also suggest disabling the poll component when you don't > > > expect any changes (ie. Maybe it doesn't start until the login is > > > submitted and then it turns off after the login successfully > > > completed). > > > > > > Does anyone know of "Streaming Requests" are handled in the next > > > servlet spec? If so, it would be cool for JSF to > > > Do something with them, allow renderkits like Trinidad to stream > > > updates in a more generic fashion. > > > > > > On Mar 4, 2011, at 5:53 AM, Richard Yee > wrote: > > > > > > > Hakon, > > > > See my email from yesterday. That is why I suggested using the > tr:poll > > > component. How many different status messages will you have? What > period > > of > > > time will the messages be changing? Depending on these answers, the > > tr:poll > > > component or the statusIndicator will work. Can you list the sequence > of > > > events the timing (ie. 2 seconds or 2 minutes later xxx happens on th= e > > > server.) are you starting a separate thread that eventually updates a > > status > > > message? > > > > > > > > Richard > > > > > > > > Sent from my iPhone > > > > > > > > On Mar 4, 2011, at 1:34 AM, H=E5kon Sagehaug > > > wrote: > > > > > > > >> Hi > > > >> > > > >> I put the form in various places, but I could not get the wanted > > effect. > > > >> Just curious, since this is an update of a value on the server sid= e. > > The > > > >> clients somehow needs to know if the value have changed or not. I > > guess > > > >> this is somewhere referred to as server push. My impression of the > > > >> partialTriggers is that an action is taken on the client side, and > > then > > > >> something is triggered on the client side. > > > >> So in my case the the value form the backing bean id read, but onl= y > > when > > > the > > > >> button is clicked, not the hole "login session". Is this correct? = I > > > guess > > > >> what to me sounds correct is to have some sort of value change > > listener > > > on > > > >> the value for the output text, but I guess that's more for input > text > > > etc > > > >> > > > >> Did this make sense? > > > >> > > > >> Cheers, H=E5kon > > > >> > > > >> > > > >> On 3 March 2011 18:18, Scott O'Bryan wrote: > > > >> > > > >>> Hakkon, put the form around everything and see if it changes the > PPR > > > >>> > > > >>> > > > >>> > > > >>> On 03/03/2011 10:00 AM, Richard Yee wrote: > > > >>> > > > >>>> what is the initial value of pollText in your backing bean? If i= t > is > > > "", > > > >>>> you > > > >>>> should set it to something else, ie. "Processing". > > > >>>> > > > >>>> The outputText inside statusIndicator will only show during the > time > > > the > > > >>>> Ajax request is being made. Once the response is returned, it wi= ll > > > >>>> disappear. > > > >>>> > > > >>>> -Richard > > > >>>> > > > >>>> > > > >>>> > > > >>>> 2011/3/3 H=E5kon Sagehaug > > > >>>> > > > >>>> Hi > > > >>>>> > > > >>>>> I now have my login page like this > > > >>>>> > > > >>>>> > > > >>>>> > > >>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > > >>>>> > > >>>>> xmlns:f=3D"http://java.sun.com/jsf/core" > > > >>>>> xmlns:h=3D"http://java.sun.com/jsf/html" > > > >>>>> xmlns:tr=3D"http://myfaces.apache.org/trinidad"> > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > > >>>>> value=3D"#{helloWorldBacking.username}" > > > >>>>> required=3D"true" /> > > > >>>>> > > > >>>>> > > >>>>> value=3D"#{helloWorldBacking.password}" > > > >>>>> required=3D"true" secret=3D"true" /> > > > >>>>> > > > >>>>> > > > >>>>> > > >>>>> partialSubmit=3D"true" > > > >>>>> actionListener=3D"#{helloWorldBacking.send}" /= > > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > > >>>>> partialTriggers=3D"loginButton" /> > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> But then I got nothing in the outPutText field. Any other > hint/tips > > > or > > > >>>>> tricks. I really appreciate the help > > > >>>>> > > > >>>>> Cheers, H=E5kon > > > >>>>> > > > >>>>> On 3 March 2011 17:25, Scott O'Bryan > wrote: > > > >>>>> > > > >>>>> That doesn't seem to make any sense to me Richard. The poll > > > component > > > >>>>>> does not replace statusIndicator, they simply do two different > > > things. > > > >>>>>> The purpose of the poll component is to initiate a request bas= ed > > on > > > a > > > >>>>>> clock instead of a user click. You still need some way to > display > > > the > > > >>>>>> information.. > > > >>>>>> > > > >>>>>> Hakon, > > > >>>>>> > > > >>>>>> The partial trigger in this case should be on the output text > > > although > > > >>>>>> having it on the status indicator should also work (you'll jus= t > > get > > > a > > > >>>>>> larger payload). > > > >>>>>> > > > >>>>>> Try this. Remove the status indicator and only have the outpu= t > > > text. > > > >>>>>> Make sure your outputText is located inside the form (possible > > your > > > >>>>>> getting a scoping issue). > > > >>>>>> > > > >>>>>> Does that work? It should. > > > >>>>>> > > > >>>>>> On Mar 3, 2011, at 9:06 AM, Richard Yee > > > > >>>>>> wrote: > > > >>>>>> > > > >>>>>> You don't want statusIndicator, use tr:poll instead > > > >>>>>>> > > > >>>>>>> Richard > > > >>>>>>> > > > >>>>>>> Sent from my iPhone > > > >>>>>>> > > > >>>>>>> On Mar 3, 2011, at 7:48 AM, H=E5kon Sagehaug< > hakon.sagehaug@uni.no > > > > > > >>>>>>> > > > >>>>>> wrote: > > > >>>>>> > > > >>>>>>> Hi > > > >>>>>>>> > > > >>>>>>>> Yes, that was an old cut and past mistake, I've got > loginButton > > as > > > id > > > >>>>>>>> > > > >>>>>>> for > > > >>>>>> > > > >>>>>>> the button. The latest test are with loginButton, not button2= . > So > > > this > > > >>>>>>>> > > > >>>>>>> way > > > >>>>>> > > > >>>>>>> of doing it should normally work? > > > >>>>>>>> > > > >>>>>>>> cheers, H=E5kon > > > >>>>>>>> > > > >>>>>>>> On 3 March 2011 16:35, Scott O'Bryan > > wrote: > > > >>>>>>>> > > > >>>>>>>> Umm. Considering the id of your button is button2, I'm not > sure > > > why > > > >>>>>>>>> your partialTrigger is loginButton. Can you explain? > > > >>>>>>>>> > > > >>>>>>>>> On Mar 3, 2011, at 6:46 AM, "H=E5kon Sagehaug"< > > > hakon.sagehaug@uni.no> > > > >>>>>>>>> wrote: > > > >>>>>>>>> > > > >>>>>>>>> Hi all, > > > >>>>>>>>>> > > > >>>>>>>>>> I might not get the full point here ;). Here is what I > tried, > > > put > > > >>>>>>>>>> > > > >>>>>>>>> trigger > > > >>>>>> > > > >>>>>>> on > > > >>>>>>>>> > > > >>>>>>>>>> the statusIndicator like here > > > >>>>>>>>>> > > > >>>>>>>>>> > > > >>>>>>>>>> > > > >>>>>>>>>> > > >>>>>>>>>> > > > >>>>>>>>> value=3D"#{helloWorldBacking.pollText}" > > > >>>>>>>>> > > > >>>>>>>>>> /> > > > >>>>>>>>>> > > > >>>>>>>>>> > > > >>>>>>>>>> > > > >>>>>>>>>> And on the outputText like here > > > >>>>>>>>>> > > > >>>>>>>>>> > > > >>>>>>>>>> > > > >>>>>>>>>> > > >>>>>>>>>> > > > >>>>>>>>> value=3D"#{helloWorldBacking.pollText}" > > > >>>>>>>>> > > > >>>>>>>>>> partialTriggers=3D"loginButton"/> > > > >>>>>>>>>> > > > >>>>>>>>>> > > > >>>>>>>>>> > > > >>>>>>>>>> Where loginButton is > > > >>>>>>>>>> > > > >>>>>>>>>> > > partialSubmit=3D"true"/> > > > >>>>>>>>>> > > > >>>>>>>>>> But nothing seems to have the wanted effect. I looks like = it > > > picks > > > >>>>>>>>>> > > > >>>>>>>>> up > > > >>>>> > > > >>>>>> the > > > >>>>>> > > > >>>>>>> initial value for the helloWorldBacking.pollText, but when th= is > > > >>>>>>>>>> > > > >>>>>>>>> value > > > >>>>> > > > >>>>>> changes it's it not propagated in the UI. Maybe this can't be > done > > > >>>>>>>>>> > > > >>>>>>>>> like > > > >>>>>> > > > >>>>>>> I've > > > >>>>>>>>> > > > >>>>>>>>>> sketched out. The backing code is the same as sent in a > > earlier > > > >>>>>>>>>> > > > >>>>>>>>> email. > > > >>>>> > > > >>>>>> Other tips? > > > >>>>>>>>>> > > > >>>>>>>>>> Cheers, H=E5kon > > > >>>>>>>>>> > > > >>>>>>>>>> > > > >>>>>>>>>> On 3 March 2011 05:23, Richard Yee > > > wrote: > > > >>>>>>>>>> > > > >>>>>>>>>> Try putting it inside the tr:form or inside your panelPage > > > >>>>>>>>>>> > > > >>>>>>>>>>> > > > >>>>>>>>>>> -Richard > > > >>>>>>>>>>> > > > >>>>>>>>>>> 2011/3/1 H=E5kon Sagehaug > > > >>>>>>>>>>> > > > >>>>>>>>>>> Hi > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple > login > > > form > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > value=3D"#{helloWorldBacking.pollText}" > > > >>>>>>>>>>>> > > > >>>>>>>>>>> /> > > > >>>>> > > > >>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > >>>>>>>>>>>> value=3D"#{helloWorldBacking.username}" > > > >>>>>>>>>>>> > > > >>>>>>>>>>> required=3D"true" > > > >>>>>> > > > >>>>>>> /> > > > >>>>>>>>>>> > > > >>>>>>>>>>>> > > >>>>>>>>>>>> value=3D"#{helloWorldBacking.password}" > > > >>>>>>>>>>>> > > > >>>>>>>>>>> required=3D"true" > > > >>>>>> > > > >>>>>>> secret=3D"true" /> > > > >>>>>>>>>>>> > > >>>>>>>>>>>> partialSubmit=3D"true" > > > >>>>>>>>>>>> action=3D"#{helloWorldBacking.send}" /> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> And parts of the backing bean > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> public String send() { > > > >>>>>>>>>>>> FacesContext facesContext =3D > > > FacesContext.getCurrentInstance(); > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> System.out.println("user name " + username + " is logg= ed > > in > > > " > > > >>>>>>>>>>>> + userLoggedIn); > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> try { > > > >>>>>>>>>>>> Thread.sleep(5000); > > > >>>>>>>>>>>> Token tok =3D tokenMgr.getToken(username, password= , > > true); > > > >>>>>>>>>>>> Thread.sleep(2000); > > > >>>>>>>>>>>> pollText =3D "Token fetched"; > > > >>>>>>>>>>>> if (tok !=3D null) { > > > >>>>>>>>>>>> userLoggedIn =3D true; > > > >>>>>>>>>>>> return ("success"); > > > >>>>>>>>>>>> } > > > >>>>>>>>>>>> username =3D ""; > > > >>>>>>>>>>>> password =3D ""; > > > >>>>>>>>>>>> } catch (TrustException e1) { > > > >>>>>>>>>>>> e1.printStackTrace(); > > > >>>>>>>>>>>> } catch (AxisFault e) { > > > >>>>>>>>>>>> e.printStackTrace(); > > > >>>>>>>>>>>> } catch (FileNotFoundException e) { > > > >>>>>>>>>>>> e.printStackTrace(); > > > >>>>>>>>>>>> } catch (XMLStreamException e) { > > > >>>>>>>>>>>> e.printStackTrace(); > > > >>>>>>>>>>>> } catch (InterruptedException e) { > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> e.printStackTrace(); > > > >>>>>>>>>>>> } > > > >>>>>>>>>>>> FacesMessage message =3D new FacesMessage("Login faile= d"); > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> facesContext.addMessage("username", message); > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> username =3D ""; > > > >>>>>>>>>>>> password =3D ""; > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> return ("error"); > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> } > > > >>>>>>>>>>>> As you can see I sleep the thread to simulate the > operations > > > >>>>>>>>>>>> > > > >>>>>>>>>>> needed > > > >>>>> > > > >>>>>> to > > > >>>>>> > > > >>>>>>> log > > > >>>>>>>>>>> > > > >>>>>>>>>>>> in the user, for now I'm only getting the token. After > that > > > I'll > > > >>>>>>>>>>>> > > > >>>>>>>>>>> fetch > > > >>>>>> > > > >>>>>>> the > > > >>>>>>>>>>> > > > >>>>>>>>>>>> project, data etc... > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> So I wanted the pollText to apear dynmically in the > status > > > >>>>>>>>>>>> > > > >>>>>>>>>>> indicator, > > > >>>>>> > > > >>>>>>> but > > > >>>>>>>>>>> > > > >>>>>>>>>>>> can get it to update,. > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> Any tips? > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> cheers, H=E5kon > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan > > > wrote: > > > >>>>>>>>>>>> > > > >>>>>>>>>>>> I see no reason why this wouldn't work.. What > specifically > > is > > > >>>>>>>>>>>>> > > > >>>>>>>>>>>> failing > > > >>>>>> > > > >>>>>>> for you and perhaps a code snipi might help me visualize your > > > >>>>>>>>>>>>> > > > >>>>>>>>>>>> issue. > > > >>>>>> > > > >>>>>>> On Mar 1, 2011, at 3:04 PM, "H=E5kon Sagehaug"< > > > >>>>>>>>>>>>> > > > >>>>>>>>>>>> hakon.sagehaug@uni.no> > > > >>>>>> > > > >>>>>>> wrote: > > > >>>>>>>>>>>>> > > > >>>>>>>>>>>>> Hi all, > > > >>>>>>>>>>>>>> > > > >>>>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a > > > question. > > > >>>>>>>>>>>>>> > > > >>>>>>>>>>>>> I'm > > > >>>>>> > > > >>>>>>> implementing a login in page for uses, and wanted to use the > > > >>>>>>>>>>>>>> statusIndicator, to give back messages for the user li= ke > > > >>>>>>>>>>>>>> > > > >>>>>>>>>>>>>> 1. Got user information > > > >>>>>>>>>>>>>> 2. Loading datasets > > > >>>>>>>>>>>>>> 3. Logged in > > > >>>>>>>>>>>>>> > > > >>>>>>>>>>>>>> And tried to have a tr:outputText within the > > > statusIndicator. > > > >>>>>>>>>>>>>> > > > >>>>>>>>>>>>> The > > > >>>>> > > > >>>>>> value > > > >>>>>>>>>>>> > > > >>>>>>>>>>>>> for > > > >>>>>>>>>>>>> > > > >>>>>>>>>>>>>> the outPuttext would be linked to a backing bean, but = I > > was > > > not > > > >>>>>>>>>>>>>> > > > >>>>>>>>>>>>> very > > > >>>>>> > > > >>>>>>> successful, do you have any other tips? > > > >>>>>>>>>>>>>> > > > >>>>>>>>>>>>>> I guess one can use the progressIndicator, but I would > > like > > > text > > > >>>>>>>>>>>>>> > > > >>>>>>>>>>>>> to > > > >>>>>> > > > >>>>>>> be > > > >>>>>>>>>>> > > > >>>>>>>>>>>> returned not a procentage progress. > > > >>>>>>>>>>>>>> > > > >>>>>>>>>>>>>> cheers, H=E5kon > > > >>>>>>>>>>>>>> > > > >>>>>>>>>>>>> > > > >>> > > > > > > --0016364274c04e3a1f049da9f093--