1 Reply Latest reply on Apr 22, 2010 2:07 AM by gasper_lf

    multiple working <a4j:poll>

    gasper_lf

      I have the following xhtml code

      <ui:composition xmlns="http://www.w3.org/1999/xhtml
      xmlns:s="http://jboss.com/products/seam/taglib
      xmlns:ui="http://java.sun.com/jsf/facelets
      xmlns:f="http://java.sun.com/jsf/core
      xmlns:h="http://java.sun.com/jsf/html
      xmlns:a4j="http://richfaces.org/a4j
      xmlns:rich="http://richfaces.org/rich"
      template="/layout/templategrupo.xhtml"> 
       
      <ui:define name="body">
              <h:outputText value="Usuario en sesion no puede conectarse al chat..."  rendered="#{!chat.conectado}"/>
             
                      <a4j:region id="r2" rendered="#{chat.conectado}">
                              <h:form>
                                      <a4j:poll id="poll" interval="5000" limitToList="true" ajaxSingle="true" reRender="poll,chatwindow,chat, users" />
                              </h:form>
                      </a4j:region>
             
              <a4j:region id="r1" rendered="#{chat.conectado}">
                              <h:form>
      ~                               <a4j:poll id="po" interval="240000" ajaxSingle="true" limitToList="true" action="#{chat.desconectar()}" reRender="po,users" />~
                              </h:form>
                      </a4j:region>
             
                      <a4j:form>
                          <div class="marcoChatTop" ></div>
                          <div class="marcoChatBotton">
                            <div class="marcoC">
                              <a4j:outputPanel id="chatwindow" layout="block">
                                      <ui:repeat value="#{chat.obtenerChat()}" var="mensaje">
                                              <h:graphicImage value="/archivos/fotospersona/#{mensaje.usuario.foto}" style="vertical-align:middle" width="40" heigth="40"/>
                                              <strong>
                                                   <h:outputText style="" value="#{mensaje.usuario.nombre} dice: " escape="false" />
                                              </strong>
                                              <h:outputText style="margin-left:200px;" value="( #{mensaje.fechaHora}" >
                                                      <f:convertDateTime pattern="EEEEE,dd-MMMMM-yyyy hh:mm a"/>
                                              </h:outputText>)
                                              <br/>
                                               <div style="text-align: justify; width: 550px; margin-left: 15px">
                                                <h:outputText  value="#{mensaje.texto}" />
                                                </div>
                                              <br />
                                      </ui:repeat>
                              </a4j:outputPanel>
                                 </div>
                                 <br/>
                                 <h:inputText id="txtbox" rendered="#{chat.conectado}" style="vertical-align:middle; margin-left:20px; margin-right:20px; width : 367px;" size="80" value="#{chat.mensaje}" />
                                  <a4j:commandButton id="chat" value="Enviar" rendered="#{chat.conectado}"
                                      action="#{chat.publicarMensaje()}" reRender="chatwindow,txtbox, users" />
                              </div>
                              <div class="marcoChatFooter"/>
                              <br/>
                              <a4j:outputPanel id="users" style="max-height:100px;height:110px;overflow:auto; width:400px;">
                                      <ui:repeat value="#{chat.obtenerListadoUsuariosConectados()}" var="usuario">
                                              <h:graphicImage style="vertical-align:middle" value="/archivos/fotospersona/#{usuario.foto}" width="40" heigth="40" />
                                              <strong><h:outputText value="#{usuario.nombre} " escape="false" /></strong>
                                              <br />
                                      </ui:repeat>
                              </a4j:outputPanel>
                      <br />
                      </a4j:form>
                     
              </ui:define> 
      </ui:composition> 

      but I have the following error when time is called,
      <a4j:poll id="po" interval="240000" ajaxSingle="true" limitToList="true" action="#{chat.desconectar()}" reRender="po,users" />

      provides an exception

      Exception during request processing:
      Caused by javax.servlet.ServletException with message: "#{chat.desconectar()}: java.lang.IllegalArgumentException: id to load is required for loading"

      help me??


                             


        • 1. Re: multiple working <a4j:poll>
          gasper_lf

          Lewis Florez wrote on Apr 22, 2010 02:06:


          I have the following xhtml code

          <ui:composition xmlns="http://www.w3.org/1999/xhtml" 
          xmlns:s="http://jboss.com/products/seam/taglib" 
          xmlns:ui="http://java.sun.com/jsf/facelets" 
          xmlns:f="http://java.sun.com/jsf/core" 
          xmlns:h="http://java.sun.com/jsf/html" 
          xmlns:a4j="http://richfaces.org/a4j" 
          xmlns:rich="http://richfaces.org/rich"
          template="/layout/templategrupo.xhtml"> 
           
          <ui:define name="body">
                  <h:outputText value="Usuario en sesion no puede conectarse al chat..."  rendered="#{!chat.conectado}"/>
                 
                          <a4j:region id="r2" rendered="#{chat.conectado}">
                                  <h:form>
                                          <a4j:poll id="poll" interval="5000" limitToList="true" ajaxSingle="true" reRender="poll,chatwindow,chat, users" />
                                  </h:form>
                          </a4j:region>
                 
                  <a4j:region id="r1" rendered="#{chat.conectado}">
                                  <h:form>
          ~                               <a4j:poll id="po" interval="240000" ajaxSingle="true" limitToList="true" action="#{chat.desconectar()}" reRender="po,users" />~
                                  </h:form>
                          </a4j:region>
                 
                          <a4j:form>
                              <div class="marcoChatTop" ></div>
                              <div class="marcoChatBotton">
                                <div class="marcoC">
                                  <a4j:outputPanel id="chatwindow" layout="block">
                                          <ui:repeat value="#{chat.obtenerChat()}" var="mensaje">
                                                  <h:graphicImage value="/archivos/fotospersona/#{mensaje.usuario.foto}" style="vertical-align:middle" width="40" heigth="40"/>
                                                  <strong>
                                                       <h:outputText style="" value="#{mensaje.usuario.nombre} dice: " escape="false" />
                                                  </strong>
                                                  <h:outputText style="margin-left:200px;" value="( #{mensaje.fechaHora}" >
                                                          <f:convertDateTime pattern="EEEEE,dd-MMMMM-yyyy hh:mm a"/>
                                                  </h:outputText>)
                                                  <br/>
                                                   <div style="text-align: justify; width: 550px; margin-left: 15px">
                                                    <h:outputText  value="#{mensaje.texto}" />
                                                    </div>
                                                  <br />
                                          </ui:repeat>
                                  </a4j:outputPanel>
                                     </div>
                                     <br/>
                                     <h:inputText id="txtbox" rendered="#{chat.conectado}" style="vertical-align:middle; margin-left:20px; margin-right:20px; width : 367px;" size="80" value="#{chat.mensaje}" />
                                      <a4j:commandButton id="chat" value="Enviar" rendered="#{chat.conectado}"
                                          action="#{chat.publicarMensaje()}" reRender="chatwindow,txtbox, users" />
                                  </div>
                                  <div class="marcoChatFooter"/>
                                  <br/>
                                  <a4j:outputPanel id="users" style="max-height:100px;height:110px;overflow:auto; width:400px;">
                                          <ui:repeat value="#{chat.obtenerListadoUsuariosConectados()}" var="usuario">
                                                  <h:graphicImage style="vertical-align:middle" value="/archivos/fotospersona/#{usuario.foto}" width="40" heigth="40" />
                                                  <strong><h:outputText value="#{usuario.nombre} " escape="false" /></strong>
                                                  <br />
                                          </ui:repeat>
                                  </a4j:outputPanel>
                          <br />
                          </a4j:form>
                         
                  </ui:define> 
          </ui:composition> 

          but I have the following error when time is called,
          <a4j:poll id="po" interval="240000" ajaxSingle="true" limitToList="true" action="#{chat.desconectar()}" reRender="po,users" />

          provides an exception

          Exception during request processing:
          Caused by javax.servlet.ServletException with message: "#{chat.desconectar()}: java.lang.IllegalArgumentException: id to load is required for loading"

          help me??


                                 





          Click HELP for text formatting instructions. Then edit this text and check the preview.