1 Reply Latest reply on Dec 17, 2008 5:18 AM by Nitin Jain

    a4j:commandButton rendered property not working with RichFac

    Nitin Jain Newbie

      We have just finished a project using RichFaces 3.2.1. Application has many CRUD functionality so we used Facelets for templating.

      we have created a Template with Back, Next, Finish [All a4j buttons]. User can navigate from one page to another page using these buttons. When user comes on the last page Finish button gets visible inplace of Next button [ we are setting rendered [true, false] property of a4j:commandButton]

      Now that 3.2.2 has released with some good patches, we tried to move our project on RichFaces 3.2.2 GA. The Application get complied with no error. But when we reach at the last page Finish button does not appear [rendered property is not working properly]

      Any suggestion on how to fix this problem would be highly appreciated.

      Development Env.

      RichFaces 3.2.1
      Facelets 1.1
      App. Server - Glassfish
      JDK 1.5


        • 1. Re: a4j:commandButton rendered property not working with Ric
          Nitin Jain Newbie

          For the sake of clearite i am attaching here the code

          UserManagement.xhtml----- Used as Template

          <html xmlns="http://www.w3.org/1999/xhtml"
           xmlns:ui="http://java.sun.com/jsf/facelets"
           xmlns:a4j="http://richfaces.org/a4j"
           xmlns:rich="http://richfaces.org/rich"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:c="http://java.sun.com/jstl/core">
          
           <head>
           <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
           <title>SolomonV2</title>
           </head>
          
           <table cellspacing="0px" style="height:100%;width:100%" border="0px" cellpadding="0px">
           <tr>
           <td >
           <table cellspacing="0px" style="height:100%;width:100%" border="0" cellpadding="0" >
           <tr>
           <td width="90%" valign="top">
           <div align="center">
           <ui:insert name="WizardContent">Content</ui:insert>
           </div>
           </td>
           </tr>
           <tr>
           <td height="2%" colspan="2">
           <h:commandButton action="previous" value="Previous <<" rendered="#{previousButtonVisibility}" />
           <h:commandButton id="nxtBtnId" action="next" value="Next >>" rendered="#{nextButtonVisibility}"/>
           <a4j:commandButton value="Finish" action="finish" rendered="#{!nextButtonVisibility}" immediate="false" id="finishButton"/>
           </td>
           </tr>
           </table>
          
           </td>
           </tr>
           </table>
          
          </html>
          ================================================
          UserDefination.xhtml --- First xhtml File

          <ui:composition 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" template="/templates/CreateUserTemplate.xhtml">
          
          
           <ui:define name="WizardContent">
           <ui:param name="previousButtonVisibility" value="false"/>
           <ui:param name="nextButtonVisibility" value="true"/>
          
           <table cellspacing="0px" style="height:100%;width:100%" border="0px" cellpadding="0px">
           <tr>
          
           <td width="15%">
           <rich:spacer width="0" id="spacerID"/>
           </td>
          
           <td>
           <table border="0px" style="text-align:left;width:100%;height:100%" cellpadding="0px" cellspacing="0px">
          
           <tr>
           <td width="114" height="40" >
           <h:outputText value="Scenario Name"/>
           </td>
           <td width="570" colspan="3">
           <h:inputText id="userNameToSave" required="true" label="User Name" />
           </td>
           </tr>
           </table>
          
           </td>
           </tr>
           </table>
          
           </ui:define>
          </ui:composition
          ================================================

          UserAdd.xhtml--- Second xhtml File

          <ui:composition 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" template="/templates/scenarioTemplate/CreateScenarioTemplate.xhtml">
          
           <ui:define name="WizardContent">
           <ui:param name="previousButtonVisibility" value="true"/>
           <ui:param name="nextButtonVisibility" value="true"/>
          
           <table border="0px" style="text-align:left;width:100%;height:100%" cellpadding="0px" cellspacing="0px">
          
           <tr>
           <td width="114" height="40" >
           <h:outputText value="User Add"/>
           </td>
           <td width="570" colspan="3">
           <a4j:region renderRegionOnly="true" id="userAddRegion" >
           <h:inputText id="userAddToSave" required="true" label="User Add" >
           <a4j:support event="onblur" reRender="msgBoxForUserAdd" ajaxSingle="true" id="userAddSupport"/>
           </h:inputText>
           <rich:message for="userAddToSave" id="msgBoxForUserAdd" style="color:red"/>
           </a4j:region>
           </td>
           </tr>
           </table>
          
          
           </ui:define>
          </ui:composition>

          ================================================

          UserFinish.xhtml--- Third xhtml File
          <ui:composition 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"
           xmlns:custom="http://www.com.accenture.solomonv2"
           template="/templates/CreateUserTemplate.xhtml">
          
           <ui:define name="Wizard">
           <ui:param name="StepToBold" value="Step3-Choose reference Scenario"/>
           </ui:define>
           <ui:define name="WizardContent">
           <ui:param name="previousButtonVisibility" value="true"/>
           <ui:param name="nextButtonVisibility" value="false"/>
          
           <table border="0px" style="text-align:left;width:100%;height:100%" cellpadding="0px" cellspacing="0px">
          
           <tr>
           <td width="114" height="40" >
           <h:outputText value="User Data"/>
           </td>
           <td width="570" colspan="3">
           <a4j:region renderRegionOnly="true" id="userNameRegion" >
           <h:inputText id="userDataToSave" required="true" label="User Data" >
           <a4j:support event="onblur" reRender="msgBoxForUserData" ajaxSingle="true" id="userDataSupport"/>
           </h:inputText>
           <rich:message for="userDataToSave" id="msgBoxForUserData" style="color:red"/>
           </a4j:region>
           </td>
           </tr>
           </table>
          
          
           </ui:define>
          </ui:composition>