9 Replies Latest reply on Jul 9, 2009 7:06 AM by Ilya Shaikovsky

    Problem with a4j:support ?

    Adi Katz Novice

      Hi,

      I found out that when a value of a backing bean changes outside the INVOKE_APPLICATION phase ( for example when a UIInput value is submitted to the server via a4j:support with AjaxSingle=true and some logic in the setValue method on the backing bean will change the user submitted value) the user submitted value will be rendered rather than the updated one.

      Reading the source code of

      com.sun.faces.renderkit.html_basic.TextRenderer


      and

      com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer


      reveals that the encodeEnd(...) method will use the submittedValue if it is there regardless if the bound value of my bean changed:

       protected String getCurrentValue(FacesContext context, UIComponent component) {
      
       if (component instanceof UIInput) {
       Object submittedValue = ((UIInput) component).getSubmittedValue();
       if (submittedValue != null) {
       return (String) submittedValue;
       }
       }
      
       String currentValue = null;
       Object currentObj = getValue(component);
       if (currentObj != null) {
       currentValue = getFormattedValue(context, component, currentObj);
       }
       return currentValue;
       }


      Am I missing something here or is it a problem with the design of a4j:support ?


      BTW, I am using jsf 1.1_02 with richfaces 3.1.4.


      If it is not clear enough I will try to supply an example

      Will appreciate any help