Doubt about attribute "Update".

UI Components for JSF
Post Reply
User avatar
neijunior
Posts: 74
Joined: 15 Jul 2010, 04:46
Location: São Paulo - Brasil

30 Aug 2010, 17:39

Hello

I have a question about the attribute "update" of components PrimeFaces.
In the examples I saw, when I run some action and send them to update it, always pass the id of a component to upgrade. Example:

Code: Select all

                <h:inputText value="#{mbPessoa.nome}"/>
                <p:commandButton action="#{mbPessoa.mostrarNome}"
                                 update="opnMostrar"/>
                                 
                <p:outputPanel id="opnMostrar">                                       
                     <h:outputLabel value="#{mbPessoa.nome}"/>
                </p:outputPanel>
- In the example I put a name in "inputText" and click on the "mostrarNome" which assigns the value for the attribute "name" and the final update is the "outPutPanel" with "outputLabel" to display the name.
So far so good, everything works normally.

But I caught a case where I have a "SubViewer" with id before "outPutPanel. Example:

Code: Select all

                <f:subview id="sbvPessoa">
                    <h:inputText value="#{mbPessoa.nome}"/>
                    <p:commandButton action="#{mbPessoa.mostrarNome}"
                                     update="sbvPessoa:opnMostrar"/>

                    <p:outputPanel id="opnMostrar">                                       
                        <h:outputLabel value="#{mbPessoa.nome}"/>
                    </p:outputPanel>
                </f:subview>
With this, the commandButton to leave the update as "opnMostrar" does not work. I need to put "sbvPessoa: opnMostrar" to get to update.

Now, you put the ID of the parent in this case or just put the ID of the component in question :?:

Thanks.

Mojarra 2.0.2, JSF 2.0, Facelets, Glassfish V3.01, Primefaces 2.1.RC1, NetBeans 6.9.
Mojarra 2.2.x, Facelets, Glassfish V4.1, Primefaces 5.1, Eclipse Mars 1, JPA 2, EJB 3

Nei Alcantara Jr.
http://twitter.com/NeiAlcantaraJr

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

30 Aug 2010, 20:04

See findComponent javadoc to see how JSF 2.0 ajax and PrimeFaces finds components, note that f:subview is a naming container.

http://download.oracle.com/javaee/6/api ... ng.String)

User avatar
neijunior
Posts: 74
Joined: 15 Jul 2010, 04:46
Location: São Paulo - Brasil

20 Sep 2010, 14:17

OK, I'll check.

Thanks
Mojarra 2.2.x, Facelets, Glassfish V4.1, Primefaces 5.1, Eclipse Mars 1, JPA 2, EJB 3

Nei Alcantara Jr.
http://twitter.com/NeiAlcantaraJr

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests