inputSuggestAjax doesn't work due to phase listener issue.
----------------------------------------------------------

                 Key: TOMAHAWK-793
                 URL: http://issues.apache.org/jira/browse/TOMAHAWK-793
             Project: MyFaces Tomahawk
          Issue Type: Bug
          Components: AJAX Form Components
    Affects Versions: 1.1.4-SNAPSHOT, 1.1.5-SNAPSHOT
            Reporter: David Green


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) {
        }
}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to