top.xhtml

En el top.xhtml

Agregamos los componentes y los principales serian

  • <p:remoteCommand

  • websocketidTopText

  • websocketIdToptext2

                            <label id="websocketidTopText" >0</label>                                                     

                             <li class="header">You have <label id="websocketidTopText2" >0</label> notifications</li>                            

Que son los que actualizamos desde el template.xhtml

   <li class="dropdown notifications-menu">
                          <h:form id="topForm">
                        <!-- Menu toggle button -->
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <i class="fa fa-bell-o"></i>
                            <span class="label label-warning">
                                <label id="websocketidTopText" >0</label>                                                     
                            </span>
                        </a>
                        <ul class="dropdown-menu">
                            <li class="header"> you have <label id="websocketidTopText2" >0</label> notifications</li>
                            <li>
                                <!-- Inner Menu: contains the notifications -->
                                <ul class="menu">
                                    <li><!-- start notification -->
                                        

                                        <p:outputLabel id="topLabel1" 
                                                       value="Value: #{pushSocket.value}"/>

                                        <p:remoteCommand 
                                            name="myFormRC" 
                                            update=":topForm:topLabel1,  :topForm:growl_top"
                                            actionListener="#{pushSocket.myAction2()}" 
                                            process="@all">
                                        </p:remoteCommand>
                                        

                                        <p:growl id="growl_top" globalOnly="true" life="5000"  showDetail="true"  />

                                    </li><!-- end notification -->
                                </ul>
                            </li>
                            <li class="footer">
                                <p:commandLink value="Ver" action="/pages/rol/list.xhtml"/> 
                               </li>
                        </ul>
                          </h:form>
                    </li>

Código completo

Last updated

Was this helpful?