Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-793

inputSuggestAjax doesn't work due to phase listener issue.

    XMLWordPrintableJSON

Details

    Description

      inputSuggestAjax doesn't work since the phase listener never gets called. The APPLY_REQUEST_VALUES phase is not entered in some circumstances, specifically if the RENDER_RESPONSE view completes early as it does when the view root is null in the following LifecycleImpl code snippet:

      //boolean viewCreated = false;
      UIViewRoot viewRoot = viewHandler.restoreView(facesContext, viewId);
      if (viewRoot == null)

      { viewRoot = viewHandler.createView(facesContext, viewId); viewRoot.setViewId(viewId); facesContext.renderResponse(); //viewCreated = true; }

      If the null view root case is entered, the lifecycle is short-circuited and the APPLY_REQUEST_VALUES phase is never entered, causing the ajax control to have no suggested values.

      I was able to get the application to work as expected by subclassing the default AjaxDecodePhaseListener as follows:

      /**

      • Override the default ajax support, since it doesn't seem to work in the
      • APPLY_REQUEST_VALUES phase, since that phase never gets entered. Process immediately
      • after the RESTORE_VIEW phase instead.
        */
        public class AjaxDecodePhaseListener
        extends org.apache.myfaces.custom.ajax.api.AjaxDecodePhaseListener
        {

      private static final long serialVersionUID = 1660766611978163100L;

      public PhaseId getPhaseId()

      { return PhaseId.RESTORE_VIEW; }

      public void afterPhase(PhaseEvent event)

      { super.beforePhase(event); }

      public void beforePhase(PhaseEvent event) {
      }
      }

      Attachments

        1. patch.txt
          1.0 kB
          David Green

        Activity

          People

            cagatay_civici Cagatay Civici
            dgreen99 David Green
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: