10 Replies Latest reply on Jan 13, 2010 7:32 PM by Arbi Sookazian

    rich:calendar not calling setter method on EJB

    Arbi Sookazian Master

      For my Seam 2.x app, I have the following rich:calendar in my h:form:

       

      <rich:calendar inputClass="dateField"
                                      rendered="#{not empty cardBillingAndSettlementEditorUI.merchantBillingGroup}"
                                      required="true"
                                      disabled="#{(pageaction == 'view') or ((pageaction == 'edit') and (cardBillingAndSettlementEditorUI.billingProgram == 'INCREMENTAL')) or (empty cardBillingAndSettlementEditorUI.merchantBillingGroup)}"
                                      value="#{cardBillingAndSettlementEditorUI.merchantBillingGroupEffectiveDate}"
                                      datePattern="MM/dd/yyyy"
                                      enableManualInput="false"
                                      label="#{messages['/restricted/merchant/current_billing_group.xhtml/field.effectiveDate']}">
                                      <a4j:support event="onchanged"
                                          reRender="#{panelId}"
                                          requestDelay="0"
                                          eventsQueue="select"
                                          ignoreDupResponses="true"
                                          onsubmit="showProgress();"
                                          oncomplete="hideProgress();" />
                                  </rich:calendar>

       

      The following method is not executed when I select a new date (i.e. when the onchanged event is fired and thus the form is submitted, the setter is not called): setMerchantBillingGroupEffectiveDate().  I added a debug stop in Eclipse for this method.

       

      public void setMerchantBillingGroupEffectiveDate(Date effectiveDate) {
              if (effectiveDate != null) {

      ...}

      }

       

      What is the reason?  This was working before until I had to refactor out a rich:calendar in same form and replace with two h:selectOneMenu components with a4j:commandButton.  The form is way too complex to post all the xhtml code here.  Any idea why the setter is not being invoked during the JSF lifecycle?  Is there any tool (I believe there was something called FacesTrace) I can use to see the exercising of the JSF lifecycle?

       

      I am thinking maybe it's the signature of the method does not match but I did not touch this particular rich:calendar config at all...

        • 1. Re: rich:calendar not calling setter method on EJB
          Arbi Sookazian Master

          we are using RF 3.3.1.GA and Seam 2.1.1.GA

           

          we are using a4j:form, not h:form in the main template.

           

          I'm assuming it's OK to using a4j:form with a4j:support/a4j:commandButton.  Would it make any difference to replace a4j:fom with h:form??

           

          Here's the main template:

           

          <a4j:form>
                      <ui:include src="card_billing_settlement.xhtml">
                          <ui:param name="pageaction" value="edit" />
                      </ui:include>
                  
                      <table style="border: 1px solid #{richSkin.panelBorderColor};" width="100%">
                          <tr>
                              <td align="center">
                                  <a4j:commandLink styleClass="widget_button"
                                      action="#{cardBillingAndSettlementEditorUI.submit}"
                                      onclick="showProgress();"
                                      oncomplete="hideProgress();">
                                      <j4j:idProxy id="update_" />
                                      <span><h:outputText value="#{messages['widget.button.update']}" /></span>
                                  </a4j:commandLink>
                                  <a4j:commandLink styleClass="widget_button"
                                      action="#{cardBillingAndSettlementEditorUI.cancel}" immediate="true">
                                      <j4j:idProxy id="lastFocus_" />
                                      <span><h:outputText value="#{messages['widget.button.cancel']}" /></span>
                                  </a4j:commandLink>
                              </td>
                          </tr>
                      </table>       
                  </a4j:form>

          • 2. Re: rich:calendar not calling setter method on EJB
            Arbi Sookazian Master

            I just reverted the changes I did for the h:selectOneMenu replacements of the other rich:calendar and the setter is now being called.  I did not alter the previous rich:calendar at all.

             

            The commented code below is apparently at least part of the root cause:

             

            <rich:calendar
                                        id="pendingBPEffectiveDate"
                                        inputClass="dateField"
                                        required="false"
                                        disabled="#{(pageaction == 'view') or (empty cardBillingAndSettlementEditorUI.pendingBillingProgram) or cardBillingAndSettlementEditorUI.billingProgramPending}"
                                        value="#{cardBillingAndSettlementEditorUI.pendingBillingProgramEffectiveDate}"
                                        datePattern="MM/dd/yyyy"
                                        enableManualInput="true"
                                        showFooter="false"
                                        showWeekDaysBar="false"
                                        styleClass="rich-calendar-month-year-only"
                                        oncurrentdateselected="event.rich.component.selectDate(event.rich.date)"
                                        label="#{messages['/restricted/merchant/pending_billing_program.xhtml/field.effectiveDate']}">
                                        <a4j:support event="oncollapse"
                                            reRender="card_billing_settlement"
                                            requestDelay="0"
                                            eventsQueue="select"
                                            ignoreDupResponses="true"
                                            onsubmit="showProgress();"
                                            oncomplete="hideProgress();" />
                                        <a4j:support event="oninputblur"
                                            reRender="card_billing_settlement"
                                            requestDelay="0"
                                            eventsQueue="select"
                                            ignoreDupResponses="true"
                                            onsubmit="showProgress();"
                                            oncomplete="hideProgress();" />
                                    </rich:calendar>
                                     <!--
                                    <h:panelGrid columns="3">
                                            <h:selectOneMenu id="startMonth1"
                                                             value="#{calendarSelectOneMenuUtil.startMonth}"
                                                             disabled="#{(pageaction == 'view') or (empty cardBillingAndSettlementEditorUI.pendingBillingProgram) or cardBillingAndSettlementEditorUI.billingProgramPending}"
                                                             required="true" >                           
                                                <s:selectItems value="#{months}"
                                                               var="month"
                                                               label="#{month}"
                                                               itemValue="#{month}"/>                           
                                            </h:selectOneMenu>
                                            <echo:decorate>
                                                <h:selectOneMenu id="startYear1"
                                                                 value="#{calendarSelectOneMenuUtil.startYear}"
                                                                 disabled="#{(pageaction == 'view') or (empty cardBillingAndSettlementEditorUI.pendingBillingProgram) or cardBillingAndSettlementEditorUI.billingProgramPending}"
                                                                  required="true" >
                                                    <s:selectItems value="#{years}"
                                                                   var="year"
                                                                   label="#{year}"
                                                                   itemValue="#{year}"/>
                                                </h:selectOneMenu>
                                            </echo:decorate>
                                            <a4j:commandButton
                                                    action="#{cardBillingAndSettlementEditorUI.submitDate}"
                                                    value="Submit"
                                                    process="startMonth1,startYear1"
                                                    reRender="card_billing_settlement"                                   
                                                    requestDelay="0"
                                                    eventsQueue="select"
                                                    ignoreDupResponses="true"
                                                    onsubmit="showProgress();"
                                                    oncomplete="hideProgress();" />                               
                                        </h:panelGrid>
                                        -->

            • 3. Re: rich:calendar not calling setter method on EJB
              Arbi Sookazian Master

              I tried changing a4j:form to h:form, results in same behavior (setter not called).

               

              also tried this as well at the same time/build:

               

              <h:panelGrid columns="3">
                                              <h:selectOneMenu id="startMonth1"
                                                               value="#{calendarSelectOneMenuUtil.startMonth}"
                                                               disabled="#{(pageaction == 'view') or (empty cardBillingAndSettlementEditorUI.pendingBillingProgram) or cardBillingAndSettlementEditorUI.billingProgramPending}"
                                                               required="true" >                           
                                                  <s:selectItems value="#{months}"
                                                                 var="month"
                                                                 label="#{month}"
                                                                 itemValue="#{month}"/>                           
                                              </h:selectOneMenu>
                                              <echo:decorate>
                                                  <h:selectOneMenu id="startYear1"
                                                                   value="#{calendarSelectOneMenuUtil.startYear}"
                                                                   disabled="#{(pageaction == 'view') or (empty cardBillingAndSettlementEditorUI.pendingBillingProgram) or cardBillingAndSettlementEditorUI.billingProgramPending}"
                                                                    required="true" >
                                                      <s:selectItems value="#{years}"
                                                                     var="year"
                                                                     label="#{year}"
                                                                     itemValue="#{year}"/>
                                                  </h:selectOneMenu>
                                              </echo:decorate>
                                              <!--
                                              <a4j:commandButton
                                                      action="#{cardBillingAndSettlementEditorUI.submitDate}"
                                                      value="Submit"
                                                      process="startMonth1,startYear1"
                                                      reRender="card_billing_settlement"                                   
                                                      requestDelay="0"
                                                      eventsQueue="select"
                                                      ignoreDupResponses="true"
                                                      onsubmit="showProgress();"
                                                      oncomplete="hideProgress();" />     
                                                      -->     
                                              <h:commandButton
                                                      action="#{cardBillingAndSettlementEditorUI.submitDate}"
                                                      value="Submit"
                                                      onsubmit="showProgress();"
                                                      oncomplete="hideProgress();" />                         
                                          </h:panelGrid>

               

              So apparently using the h: equivalent tags does not solve the problem...

              • 4. Re: rich:calendar not calling setter method on EJB
                Arbi Sookazian Master

                reproduced on IE8.0 and FF3.5.7.

                 

                unable to try out facestrace lib (facestrace-1.0.1.jar) due to following error during login:

                 

                "Unexpected failure: value of context variable is not an instance of the component bound to the context variable: merchantFinder. If you are using hot deploy, you may have attempted to hot deploy a session or application-scoped component definition while using an old instance in the session."

                • 5. Re: rich:calendar not calling setter method on EJB
                  Arbi Sookazian Master

                  Here is the output of a lifecycle PhaseListener impl:

                   

                  14:25:59,002 INFO  [LifeCycleListener] LifeCycleListener: START PHASE RESTORE_VIEW 1
                  14:26:00,752 INFO  [LifeCycleListener] LifeCycleListener: END PHASE RESTORE_VIEW 1
                  14:26:01,986 INFO  [LifeCycleListener] LifeCycleListener: START PHASE APPLY_REQUEST_VALUES 2
                  14:26:08,219 INFO  [LifeCycleListener] LifeCycleListener: END PHASE APPLY_REQUEST_VALUES 2
                  14:26:10,156 INFO  [LifeCycleListener] LifeCycleListener: START PHASE PROCESS_VALIDATIONS 3
                  14:26:13,468 INFO  [LifeCycleListener] LifeCycleListener: END PHASE PROCESS_VALIDATIONS 3
                  14:26:14,593 INFO  [LifeCycleListener] LifeCycleListener: START PHASE UPDATE_MODEL_VALUES 4
                  14:26:18,124 INFO  [LifeCycleListener] LifeCycleListener: END PHASE UPDATE_MODEL_VALUES 4
                  14:26:37,793 INFO  [LifeCycleListener] LifeCycleListener: START PHASE INVOKE_APPLICATION 5
                  14:26:39,683 INFO  [LifeCycleListener] LifeCycleListener: END PHASE INVOKE_APPLICATION 5
                  14:26:40,714 INFO  [LifeCycleListener] LifeCycleListener: START PHASE RENDER_RESPONSE 6
                  14:26:43,745 INFO  [LifeCycleListener] LifeCycleListener: END PHASE RENDER_RESPONSE 6

                   

                  So my assumption was incorrect I guess?  So why does the setter method not get executed if the update model values phase is successful??

                  • 6. Re: rich:calendar not calling setter method on EJB
                    Nick Belaevski Master

                    Hi,

                     

                    Try removing "rendered" & "disabled" attributes.

                    1 of 1 people found this helpful
                    • 7. Re: rich:calendar not calling setter method on EJB
                      Arbi Sookazian Master
                      I still need the "rendered" and "disabled" functionality for the rich:calendar.  Should I replace with a4j:outputPanel around the rich:calendar?  Is this the best solution?
                      • 8. Re: rich:calendar not calling setter method on EJB
                        Arbi Sookazian Master

                        Your suggestion did not work:

                         

                        <rich:calendar inputClass="dateField"                               
                                                        required="true"
                                                        value="#{cardBillingAndSettlementEditorUI.merchantBillingGroupEffectiveDate}"
                                                        datePattern="MM/dd/yyyy"
                                                        enableManualInput="false"
                                                        label="#{messages['/restricted/merchant/current_billing_group.xhtml/field.effectiveDate']}">
                                                        <a4j:support event="onchanged"
                                                            reRender="#{panelId}"
                                                            requestDelay="0"
                                                            eventsQueue="select"
                                                            ignoreDupResponses="true"
                                                            onsubmit="showProgress();"
                                                            oncomplete="hideProgress();" />
                                                    </rich:calendar>

                         

                        Setter still not executed.

                         

                        When I did this for the very first line of the facelet:

                         

                        <a4j:outputPanel id="#{panelId}">

                         

                        it did work (setter is now called).

                         

                        This is the existing/current code:

                         

                        <a4j:outputPanel id="#{panelId}"
                                rendered="#{((cardBillingAndSettlementEditorUI.billingProgram == 'INCREMENTAL') or (cardBillingAndSettlementEditorUI.pendingBillingProgram == 'INCREMENTAL')) and ((not empty cardBillingAndSettlementEditorUI.merchantBillingGroupEffectiveDate) or cardBillingAndSettlementEditorUI.newBillingProgram)}">

                        • 10. Re: rich:calendar not calling setter method on EJB
                          Arbi Sookazian Master

                          I added session-scope to my backing bean:

                           

                          @Name("cardBillingAndSettlementEditorUI")
                          @MeasureCalls
                          @Stateful
                          @Scope(ScopeType.SESSION) 
                          public class CardBillingAndSettlementEditorUIBean implements CardBillingAndSettlementEditorUI {

                          ... }

                           

                          The setter for the calendar is still not called.  not sure if this is related to the other thread you posted....