2 Replies Latest reply on Apr 14, 2010 5:54 AM by Harut Sargsyan

    Troubles using richfaces with facelets

    Rodrigo Barcellos Newbie

      Hi;

      I´m development a system that uses the combination JSF+Facelets+Richfaces, but i´m having problems when I put a component richfaces inside tag composition from facelets. Simply the components doesnt showed and happen a javascript error on lib richfaces.

      I would like know if are there some location in the composition tag where I must put the richfaces component in order to fixing the problem...

      When I remove the tag composition from the facelets page, the page stop using the template and the component starts to work.

      Are there come explanation for this???

      Page source...

       

       

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <!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:t="http://myfaces.apache.org/tomahawk"
            xmlns:a4j="http://richfaces.org/a4j"
            xmlns:rich="http://richfaces.org/rich">

       

          <head>
              <a4j:loadStyle src="../css/generic.css"></a4j:loadStyle>    
          </head>
                 
          <ui:composition template="../templates/maintemplate.xhtml">                       
              <ui:define name="content">
                  <h:form id="main">                               
                      <t:panelGrid columns="1" style="text-align:center;">
                          <rich:panel style=" width : 300px;" headerClass="header" bodyClass="corpo">
                              <f:facet name="header">
                                  <h:outputText value="Grupos de Veículos" />
                              </f:facet>                               
                              <t:panelGrid columns="2" style="text-align:left;">
                                  <t:panelGroup colspan="2">
                                      <h:outputText id="lblempresa" value="Empresa (matrizes)" styleClass="label"/>
                                  </t:panelGroup>
                                  <t:panelGroup colspan="2">
                                      <h:selectOneMenu id="cmbempresa" value="#{vehicleGroupBean.group.branchId}" styleClass="campo_obrigatorio_200">
                                          <f:selectItem itemValue="-1" itemLabel="Selecione um item"/>
                                          <f:selectItems value="#{vehicleGroupBean.comboCustomers}"/>                                               
                                              <a4j:support ajaxSingle="true" event="onchange" immediate="true" reRender="cmbgroup" action="#{vehicleGroupBean.loadGroups}"/>                                               
                                      </h:selectOneMenu>
                                  </t:panelGroup>
                                  <t:panelGroup colspan="2">
                                      <h:outputText id="lblgrupos" value="Grupos" styleClass="label"/>
                                  </t:panelGroup>
                                  <t:panelGroup colspan="2" style="text-align:right;">
                                      <h:selectOneMenu id="cmbgroup" value="#{vehicleGroupBean.group.groupId}" styleClass="campo_obrigatorio_200">
                                          <f:selectItem itemValue="-1" itemLabel="Selecione um item"/>
                                          <f:selectItems value="#{vehicleGroupBean.groups}"/>                                               
                                      </h:selectOneMenu>
                                  </t:panelGroup>                                                                                         
                              </t:panelGrid>
                          </rich:panel>                            
                      </t:panelGrid>
                      <a4j:commandLink value="xxxxx" ajaxSingle="true" id="editlink" oncomplete="#{rich:component('modal:editPanel')}.show()"/>                                                                                                      
                  </h:form>
                  <h:form ajaxSingle="true" id="modal">       
                      <rich:modalPanel id="editPanel" autosized="true" width="450" zindex="2000">
                          <f:facet name="header">
                              <h:outputText value="Edit Current Car" />
                          </f:facet>
                          <f:facet name="controls">
                              <h:panelGroup>
                                  <h:commandLink value="XXX" id="hidelink"/>
                                      <rich:componentControl for="editPanel" attachTo="hidelink" operation="hide" event="onclick" />                  
                              </h:panelGroup>
                          </f:facet>              
                              <rich:messages style="color:red;"></rich:messages>
                              <h:panelGrid columns="1">
                                  <a4j:outputPanel ajaxRendered="true">
                                      <h:panelGrid columns="2">
                                          <h:outputText value="Make" />                         
                                          <h:outputText value="Price" />                         
                                      </h:panelGrid>
                                      <rich:message showSummary="true" showDetail="false" for="price" />
                                  </a4j:outputPanel>
                                  <a4j:commandButton value="Store"
                                      action="#{vehicleGroupBean.acaoGeral}"
                                      reRender="make, model, price"
                                      oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('editPanel')}.hide();" />
                              </h:panelGrid>                
                      </rich:modalPanel>   
                  </h:form>                                                                                                                                                  
              </ui:define>                    
          </ui:composition>       
      </html>

       

       

      Template source...

       

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <!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:h="http://java.sun.com/jsf/html"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:t="http://myfaces.apache.org/tomahawk"
            xmlns:a4j="http://richfaces.org/a4j"
            xmlns:rich="http://richfaces.org/rich">
          <head>
              <a4j:loadStyle src="../css/generic.css"></a4j:loadStyle>
          </head>
          <body>
              <div id="header">
                  <ui:insert name="header">
                      Inserir Novo Cabeçalho
                  </ui:insert>   
              </div>
              <div id="menu">
                  <ui:insert name="menu">
                      <ui:include src="../pages/menu.xhtml" />
                  </ui:insert>
              </div>   
              <div id="content">           
                      <ui:insert name="content">
                          Inserir Novo Corpo
                      </ui:insert>           
              </div>   
              <div id="footer">
                  <ui:insert name="footer">
                       Inserir Novo Rodapé
                  </ui:insert>
              </div>
          </body>       
      </html>

       

      The component rich:modalPanel doesnt works, and generate this error..

       

       

      Message: Object does not support this property or  method
      Line: 2
      Char: 240
      Code: 0
      URI:   http://localhost:8080/FrotaAgricola/a4j/g/3_2_2.SR1org/richfaces/renderkit/html/scripts/modalPanelBorders.js.jsf

       

       

      If I remove the <ui:composition template="../templates/maintemplate.xhtml"></ui:composition> tags the component run without errors.

      In other pages that I dont use richfaces components run ok.

       

      Thank for any help