1 Reply Latest reply on Nov 14, 2012 2:28 AM by Juan Perez

    Problems with facelets template layout and a4j:commandButton

    Juan Perez Newbie

      Hi Everyone!!

       

      I used ricfaces 2.x a lot time ago, and now im tryin to use the last release 4.2.3, but i have the next problem:

       

      I created an layout.xhtml and layout-client, the respective header, content and footer xhtml, and i could insert a xhtml form in the layout-client.xhtml. But when i try to implement a simple example of render using the tag a4j:commandButton the botton isnt work, i tried use action, actionlistener, execute but apparently nothing works. Next this i put all the code i have.

       

      Este es el backbean utilizado:

       

      @ManagedBean
      @SessionScoped
      public class TipoIncidenteBean {
      
          private TipoIncidente tipoIncidente = new TipoIncidente();
          private String nombreTipoIncidente = "";
          private String descripcionTipoIncidente = "";
      
      
          //////////////////////////////// GET - SET /////////////////////////////////
          public String getNombreTipoIncidente() {
              return nombreTipoIncidente;
          }
      
          public void setNombreTipoIncidente(String nombreTipoIncidente) {
              this.nombreTipoIncidente = nombreTipoIncidente;
          }
      
          public String getDescripcionTipoIncidente() {
              return descripcionTipoIncidente;
          }
      
          public void setDescripcionTipoIncidente(String descripcionTipoIncidente) {
              this.descripcionTipoIncidente = descripcionTipoIncidente;
          }
      }
      

       

      Estos son los layout y layout-client:

       

       

       

      layout-client:

       

       

      y este es el xhtml que se carga en el content:

       

       

       

      This must render the outputPanel with the name that i write, but it doenst. Really i need anyhelp you can offer to me.

       

      Thks a lot.

        • 1. Re: Problems with facelets template layout and a4j:commandButton
          Juan Perez Newbie

          This are the layout and layout-client:

           

           

          '
          <?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">
          
          <h:head>
              <link href="./../resources/css/default.css" rel="stylesheet"
                  type="text/css" />
              <link href="./../resources/css/cssLayout.css" rel="stylesheet"
                  type="text/css" />
              <title>RESPUESTA INCIDENTES</title>
          </h:head>
          
          <body>
          
              <div>
                  <div id="top">
                      <ui:insert name="top" />
                  </div>
                  <div>
                      <div id="left">
                          <ui:insert name="left" />
                      </div>
                      <div id="content" class="left_content">
                          <ui:insert name="content" />
                      </div>
                  </div>
                  <div id="bottom">
                      <ui:insert name="bottom" />
                  </div>
              </div>
          </body>
          
          </html>
          

           

          Layout-Client:

           

           

          <?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: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">
          
          <body style="z-index: 0;">
          
              <ui:composition template="./layout.xhtml">
          
                  <ui:define name="top">
                      <ui:include src="./../header.xhtml" />
                  </ui:define>
          
                  <ui:define name="left">
                      <ui:include src="./../sideBar.xhtml" />
                  </ui:define>
          
                  <ui:define name="content">
                      <h:form>
                          <rich:panel style="background-color:transparent;border-width:0px">
                              <ui:include src="#{pageViewIdGenerator.includedPage}"
                                  style="background-color:transparent;border-width:0px" />
                          </rich:panel>
                      </h:form>
                  </ui:define>
          
                  <ui:define name="bottom">
                      <ui:include src="./../footer.xhtml" />
                  </ui:define>
          
              </ui:composition>
          </body>
          </html>
          

           

          and the xhtml loaded into the content:

           

           

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <ui:composition 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:a4j="http://richfaces.org/a4j"
              xmlns:rich="http://richfaces.org/rich">
              <h:outputStylesheet>
                  .outhello {
                  font-weight: bold;
                  }
              </h:outputStylesheet>
              <h:form>
                  <h:panelGrid columns="3">
                      <h:outputText value="Name:" />
                      <h:inputText value="#{tipoIncidenteBean.nombreTipoIncidente}" />
                      <a4j:commandButton value="Say Hello" render="out" execute="@form" />
                  </h:panelGrid>
              </h:form>
              <br />
              <a4j:outputPanel id="out">
                  <h:outputText value="Hello #{tipoIncidenteBean.nombreTipoIncidente} !"
                      rendered="#{not empty tipoIncidenteBean.nombreTipoIncidente}"
                      styleClass="outhello" />
              </a4j:outputPanel>
          </ui:composition>
          

           

          I tried use <html> instead <ui:composition> and isnt work!!

           

          Thks!!!