myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Yee <richard.k....@gmail.com>
Subject Re: Using statusIndicator
Date Thu, 03 Mar 2011 17:00:28 GMT
what is the initial value of pollText in your backing bean? If it 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 will
disappear.

-Richard



2011/3/3 Håkon Sagehaug <hakon.sagehaug@uni.no>

> Hi
>
> I now have my login page like this
>
> <?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:f="http://java.sun.com/jsf/core"
>    xmlns:h="http://java.sun.com/jsf/html"
>    xmlns:tr="http://myfaces.apache.org/trinidad">
>
> <f:view>
>    <tr:document title="eSysbio-myFaces-Trinidad">
>
>        <tr:panelPage>
>            <f:facet name="infoStatus">
>                <tr:legend name="required" />
>            </f:facet>
>            <tr:form>
>                <h:panelGrid colums="2">
>                    <tr:outputLabel value="Username" />
>                    <tr:inputText id="username"
> value="#{helloWorldBacking.username}"
>                        required="true" />
>                    <tr:outputLabel value="Password" />
>                    <tr:inputText id="password"
> value="#{helloWorldBacking.password}"
>                        required="true" secret="true" />
>
>                </h:panelGrid>
>                <tr:commandButton id="loginButton" text="Login"
> partialSubmit="true"
>                    actionListener="#{helloWorldBacking.send}" />
>
>
>                <!--
>                <tr:statusIndicator>
>                    <tr:outputText value="#{helloWorldBacking.pollText}" />
>                </tr:statusIndicator>
>                 -->
>                <tr:outputText value="#{helloWorldBacking.pollText}"
>                    partialTriggers="loginButton" />
>            </tr:form>
>        </tr:panelPage>
>
>    </tr:document>
> </f:view>
> </html>
>
> But then I got nothing in the outPutText field. Any other hint/tips or
> tricks. I really appreciate the help
>
> Cheers, Håkon
>
> On 3 March 2011 17:25, Scott O'Bryan <darkarena@gmail.com> 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 based 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 just get a
> > larger payload).
> >
> > Try this.  Remove the status indicator and only have the output 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 <richard.k.yee@gmail.com> wrote:
> >
> > > You don't want statusIndicator, use tr:poll instead
> > >
> > > Richard
> > >
> > > Sent from my iPhone
> > >
> > > On Mar 3, 2011, at 7:48 AM, Håkon 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åkon
> > >>
> > >> On 3 March 2011 16:35, Scott O'Bryan <darkarena@gmail.com> 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åkon 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
> > >>>>
> > >>>> <tr:statusIndicator partialTriggers="loginButton">
> > >>>>                  <f:facet name="busy">
> > >>>>                      <tr:outputText
> > >>> value="#{helloWorldBacking.pollText}"
> > >>>> />
> > >>>>                  </f:facet>
> > >>>>              </tr:statusIndicator>
> > >>>>
> > >>>> And on the outputText like here
> > >>>>
> > >>>> <tr:statusIndicator partialTriggers="loginButton">
> > >>>>                  <f:facet name="busy">
> > >>>>                      <tr:outputText
> > >>> value="#{helloWorldBacking.pollText}"
> > >>>> partialTriggers="loginButton"/>
> > >>>>                  </f:facet>
> > >>>>              </tr:statusIndicator>
> > >>>>
> > >>>> Where loginButton is
> > >>>>
> > >>>> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
> > >>>>
> > >>>> But nothing seems to have the wanted effect. I looks like it picks
> up
> > the
> > >>>> initial value for the helloWorldBacking.pollText, but when this
> 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åkon
> > >>>>
> > >>>>
> > >>>> On 3 March 2011 05:23, Richard Yee <richard.k.yee@gmail.com>
wrote:
> > >>>>
> > >>>>> Try putting it inside the tr:form or inside your panelPage
> > >>>>>
> > >>>>>
> > >>>>> -Richard
> > >>>>>
> > >>>>> 2011/3/1 Håkon Sagehaug <hakon.sagehaug@uni.no>
> > >>>>>
> > >>>>>> Hi
> > >>>>>>
> > >>>>>> Thanks for the reply, here is my xhtml, with a simple login
form
> > >>>>>>
> > >>>>>> <tr:document title="Login Demo">
> > >>>>>>     <tr:statusIndicator>
> > >>>>>>         <f:facet name="busy">
> > >>>>>>             <tr:outputText value="#{helloWorldBacking.pollText}"
> />
> > >>>>>>         </f:facet>
> > >>>>>>     </tr:statusIndicator>
> > >>>>>>     <tr:form>
> > >>>>>>
> > >>>>>>         <tr:panelPage>
> > >>>>>>             <f:facet name="infoStatus">
> > >>>>>>                 <tr:legend name="required" />
> > >>>>>>             </f:facet>
> > >>>>>>
> > >>>>>>             <tr:inputText label="Username" id="username"
> > >>>>>>                 value="#{helloWorldBacking.username}"
> > required="true"
> > >>>>> />
> > >>>>>>
> > >>>>>>             <tr:inputText label="Password" id="password"
> > >>>>>>                 value="#{helloWorldBacking.password}"
> > required="true"
> > >>>>>> secret="true" />
> > >>>>>>             <tr:commandButton id="button2" text="Login"
> > >>>>>> partialSubmit="true"
> > >>>>>>                 action="#{helloWorldBacking.send}" />
> > >>>>>>         </tr:panelPage>
> > >>>>>>
> > >>>>>>     </tr:form>
> > >>>>>>
> > >>>>>> </tr:document>
> > >>>>>>
> > >>>>>> And parts of the backing bean
> > >>>>>>
> > >>>>>> public String send() {
> > >>>>>>     FacesContext facesContext = FacesContext.getCurrentInstance();
> > >>>>>>
> > >>>>>>     System.out.println("user name " + username + " is logged
in "
> > >>>>>>             + userLoggedIn);
> > >>>>>>
> > >>>>>>     try {
> > >>>>>>         Thread.sleep(5000);
> > >>>>>>         Token tok = tokenMgr.getToken(username, password,
true);
> > >>>>>>        Thread.sleep(2000);
> > >>>>>>         pollText = "Token fetched";
> > >>>>>>         if (tok != null) {
> > >>>>>>             userLoggedIn = true;
> > >>>>>>             return ("success");
> > >>>>>>         }
> > >>>>>>         username = "";
> > >>>>>>         password = "";
> > >>>>>>     } 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 = new FacesMessage("Login failed");
> > >>>>>>
> > >>>>>>     facesContext.addMessage("username", message);
> > >>>>>>
> > >>>>>>     username = "";
> > >>>>>>     password = "";
> > >>>>>>
> > >>>>>>     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åkon
> > >>>>>>
> > >>>>>> On 1 March 2011 23:23, Scott O'Bryan <darkarena@gmail.com>
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åkon 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 like
> > >>>>>>>>
> > >>>>>>>> 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åkon
> > >>>>>>>
> > >>>>>>
> > >>>>>
> > >>>
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message