9 Replies Latest reply on May 13, 2010 8:17 AM by Walter Hernandez

    Facelets templates not work correctly in Richfaces 3.3.3?

    Walter Hernandez Newbie

      Hi, I'm new in the community

       

      I'm using RichFaces 3.3.3 with JSF 2.0, exactly as the documentation says. With Facelets outside JSF, with the jsf-facelets library.

       

      My  problem is that Facelets templeates are refreshed completly with each navigation  rule is executed after each action, ie not only repainted the page with the  tag inserted ui:insert, but repaint all pages included in the template.

       

      I have  no this problem with ICEfaces Facelets.

      I would like to know if this is a bug of RichFaces or may be a configuration problem, someone has this happened?

       

      the  source code is as follows:


      web.xml

      ...

      <servlet>
              <servlet-name>Faces Servlet</servlet-name>
              <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
              <load-on-startup>1</load-on-startup>
      </servlet>

      <servlet-mapping>
              <servlet-name>Faces Servlet</servlet-name>
              <url-pattern>*.jsf</url-pattern>
      </servlet-mapping>

      <context-param>
              <param-name>facelets.DEVELOPMENT</param-name>
              <param-value>true</param-value>
      </context-param>
      <context-param>
              <param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
              <param-value>true</param-value>
      </context-param>
      <context-param>
              <param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
              <param-value>true</param-value>
      </context-param>
      <filter>
              <display-name>Ajax4jsf Filter</display-name>
              <filter-name>ajax4jsf</filter-name>
              <filter-class>org.ajax4jsf.Filter</filter-class>
      </filter>
      <filter-mapping>
              <filter-name>ajax4jsf</filter-name>
              <servlet-name>Faces Servlet</servlet-name>
              <dispatcher>REQUEST</dispatcher>
              <dispatcher>FORWARD</dispatcher>
              <dispatcher>INCLUDE</dispatcher>
      </filter-mapping>
      ...


      plantilla-principal.xhtml

      ...

      <body> 

          <div>
              <ui:include src="../common/sistema/ZonaLogoCliente.xhtml" />
          </div>
          <div>
              <ui:include src="../common/sistema/Cabecera.xhtml" />
          </div>
          <div>
              <ui:include src="../common/sistema/Zona0.xhtml" />
          </div>
          <div>
              <ui:include src="../common/sistema/Zona1.xhtml" />
          </div>
          <div>
              <ui:insert name="cuerpoSistema" />
          </div>
          <div>
              <ui:include src="../common/sistema/Menu.xhtml" />
          </div>
          <div>
              <ui:include src="../common/sistema/Pie.xhtml" />
          </div>

      <body>

      ...

       

      EstructuraListarEmpleados.xhtml

      ...

      <ui:composition
          template="../../../template/plantilla-principal.xhtml"
          xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets">
          <ui:define name="cuerpoSistema">
              <ui:include src="../ListarEmpleados.xhtml" />
          </ui:define>
      </ui:composition>

      ...

       

      "ListarEmpleados.xhtml" is  shown correctly, but the repainting of all pages included in the  template is very obvious.

       

      I have  the suspicion that the problem may be the html tag "body" in  "plantilla-principal", instead it should use "h: body" supported by JSF  2.0, but not by RichFaces 3.3.3 apparently. This is fixed  with version 4 may be??

       

      Excuse  my English, I am very Argentine ...

      Any comment will Thanked ...

        • 2. Re: Facelets templates not work correctly in Richfaces 3.3.3?
          Nick Belaevski Master

          Hi Walter,

           

          Try two things:

           

          1) Remove:

           

          <context-param>
                  <param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
                  <param-value>true</param-value>
          </context-param>

           

          2) Check this link: https://jira.jboss.org/jira/browse/RF-3341

          • 3. Re: Facelets templates not work correctly in Richfaces 3.3.3?
            Walter Hernandez Newbie

            Thanks for your reply Nick!!!, but unfortunately  that did not work.

             

            I'll  keep trying, any suggestion is well.

            • 4. Re: Facelets templates not work correctly in Richfaces 3.3.3?
              Ilya Shaikovsky Master

              have you checked issue Nick mentioned? If iteration components data called - you have to workaround that by using limittolist on ajax components or use wrapping to region with renderRegionOnly=true

              • 5. Re: Facelets templates not work correctly in Richfaces 3.3.3?
                Ilya Shaikovsky Master

                also please sow the code related to problematic ajax requests(page, actions).

                • 6. Re: Facelets templates not work correctly in Richfaces 3.3.3?
                  Walter Hernandez Newbie

                  Ok, i will try that way...

                   

                  Here is the page "ListarEmpleados.xhtml"

                   

                  <?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:ui="http://java.sun.com/jsf/facelets"

                      xmlns:h="http://java.sun.com/jsf/html"

                      xmlns:f="http://java.sun.com/jsf/core"

                      xmlns:a4j="http://richfaces.org/a4j"

                      xmlns:rich="http://richfaces.org/rich"

                      contentType="text/html" pageTitle="Listado de Empleados">

                   

                       <a4j:form id="idFormListarEmpleados">

                          <rich:panel

                              style="position: absolute; left: 202px; top: 35px; width: 85%; height: 75px;">

                          <f:facet name="header">

                              <h:outputText value="Filtros" style="position: relative; left: 5px;" />

                          </f:facet>

                   

                           <!-- Nombre -->

                          <h:outputLabel value="Nombre" for="idFiltroNombre" />

                          <h:inputText id="idFiltroNombre"

                              value="#{empleadoAction.filtro.nombres}"

                              style="position: relative; left: 2px;" />

                   

                           <rich:spacer width="10" />

                   

                           <!-- Apellido -->

                          <h:outputLabel value="Apellido" for="idFiltroApellido" />

                          <h:inputText id="idFiltroApellido"

                              value="#{empleadoAction.filtro.apellido}"

                              style="position: relative; left: 2px;" />

                          </rich:panel>


                              <rich:extendedDataTable id="idDataTableListarEmpleados"

                                  value="#{empleadoAction.listaEmpleados}" var="empleadoActual"

                                  rows="15" reRender="idDataScrollerListarEmpleados" height="425px"

                                  width="85%"

                                  style="position: relative; left: 15.2%; top: 115px; border: solid 1px #11808A;">


                                  <f:facet name="header">

                                      <rich:panelBar style="left: 0px;">

                                          <a4j:commandButton image="/recursos/botones/toolbar/Nuevo.png" />

                                          <a4j:commandButton image="/recursos/botones/toolbar/Editar.png" />

                                          <a4j:commandButton image="/recursos/botones/toolbar/Ver.png" />

                                          <a4j:commandButton image="/recursos/botones/toolbar/Borrar.png" />

                                          <a4j:commandButton image="/recursos/botones/toolbar/Filtrar.png" actionListener="#{empleadoAction.filtrar}" reRender="idDataTableListarEmpleados"/>

                   

                                       </rich:panelBar>

                                  </f:facet>

                                  <rich:column>

                                      <f:facet name="header">

                                          <h:outputText value="Nombre" />

                                      </f:facet>

                                      <h:outputText value="#{empleadoActual.nombres}" />

                                  </rich:column>

                                  <rich:column id="idColumnaEmpleadoApellido" sortBy="#{empleadoActual.apellido}">

                                      <f:facet name="header">

                                          <h:outputText value="Apellido" />

                                      </f:facet>

                                      <h:outputText value="#{empleadoActual.apellido}" />

                                  </rich:column>

                                  <rich:column>

                                      <f:facet name="header">

                                          <h:outputText value="Tipo de documento" />

                                      </f:facet>

                                      <h:outputText value="#{empleadoActual.tipoDocumento}" />

                                  </rich:column>

                                  <rich:column>

                                      <f:facet name="header">

                                          <h:outputText value="Nº documento" />

                                      </f:facet>

                                      <h:outputText value="#{empleadoActual.nroDocumento}" />

                                  </rich:column>

                                  <rich:column>

                                      <f:facet name="header">

                                          <h:outputText value="Fecha de nacimiento" />

                                      </f:facet>

                                      <h:outputText value="#{empleadoActual.fechaNacimiento}" />

                                  </rich:column>

                                  <rich:column>

                                      <f:facet name="header">

                                          <h:outputText value="Sexo" />

                                      </f:facet>

                                      <h:outputText value="#{empleadoActual.sexo}" />

                                  </rich:column>

                                  <rich:column>

                                      <f:facet name="header">

                                          <h:outputText value="Legajo" />

                                      </f:facet>

                                      <h:outputText value="#{empleadoActual.legajo}" />

                                  </rich:column>

                                  <rich:column sortBy="#{empleadoActual.cuil}">

                                      <f:facet name="header">

                                          <h:outputText value="Cuil" />

                                      </f:facet>

                                      <h:outputText value="#{empleadoActual.cuil}" />

                                  </rich:column>

                                  <rich:column>

                                      <f:facet name="header">

                                          <h:outputText value="Cargo" />

                                      </f:facet>

                                      <h:outputText value="#{empleadoActual.cargo}" />

                                  </rich:column>

                                  <f:facet name="footer">

                                      <rich:datascroller align="center" />

                                  </f:facet>

                   

                               </rich:extendedDataTable>

                   

                      </a4j:form>

                   

                  </html>

                   


                  Here is my action in backing bean EmpleadoAction.

                   

                  public String inicioListarEmpleados() {

                            return "inicioListarEmpleados";

                  }


                  And my rule navegation in faces-config.xml

                   

                  <navigation-rule>
                          <from-view-id>*</from-view-id>
                          <navigation-case>
                              <from-outcome>inicioListarEmpleados</from-outcome>
                              <to-view-id>/paginas/maestro/empleado/estructura/EstructuraListarEmpleados.xhtml</to-view-id>
                          </navigation-case>
                  </navigation-rule>

                   

                  This  behavior occurs on any page, navigation rules, action, etc. In all system.

                  • 7. Re: Facelets templates not work correctly in Richfaces 3.3.3?
                    Walter Hernandez Newbie

                    Ilya, i tried that way, but i think that i'm not understanding it, if you give me a small example would be very grateful.

                    • 8. Re: Facelets templates not work correctly in Richfaces 3.3.3?
                      Ilya Shaikovsky Master

                      hey, sorry but seems there was some misunderstanding..

                       

                      My  problem is that Facelets templeates are refreshed completly with each navigation  rule is executed after each action, ie not only repainted the page with the  tag inserted ui:insert, but repaint all pages included in the template.

                      if you mean that you expecting that only ui:insert will be repainted and ui:includes will not - this will never works in that way. And this not related to RichFaces anyhow. All the page redrawn on navigation and this absolutelly normal behavior of JSF and Facelets. Facelets has no feature of navigating only in context of insert component.

                       

                      But RichFaces has such feature. please review the a4j:include component sample carefully maybe it will be helpful.

                      http://livedemo.exadel.com/richfaces-demo/richfaces/include.jsf

                      • 9. Re: Facelets templates not work correctly in Richfaces 3.3.3?
                        Walter Hernandez Newbie

                        Ok Ilya, thanks for your help!

                         

                        I'll  have a look at a4j: include