javajsfuser-interfaceicefacesicefaces-1.8

SelectInputText ValueChangeListener Issues in IceFaces 1.8


I am using ICEFaces 1.8 for my application. I have a few SelectInputText in a grid like this:

<ice:panelGrid columns="4">             
            <ice:selectInputText id="txtId"                             
                         valueChangeListener="#{employeeBean.searchIdListener}" partialSubmit="true"></ice:selectInputText>
            <ice:selectInputText id="txtFirstName"
                         valueChangeListener="#{employeeBean.searchFirstNameListener}" partialSubmit="true"></ice:selectInputText>
            <ice:selectInputText id="txtLastName"
                         valueChangeListener="#{employeeBean.searchLastNameListener}" partialSubmit="true"></ice:selectInputText>
            <ice:selectInputText id="txtPhoneNumber"
                         valueChangeListener="#{employeeBean.searchPhnNbrListener}" partialSubmit="true"></ice:selectInputText>
        </ice:panelGrid>

When I change the value of any one of the above SelectInputText, I can see that all the above four ValueChangeListener methods are getting executed - WHY?

Should not it be only the method getting executed whose SelectInputText have some value changes?

Please let me know about this.


Solution

  • I think this stems from a misunderstanding of what the partialSubmit attribute is intended to do as well as a misunderstanding of the valueChangeListener.

    When submitting a form by clicking a submit button lets say, all components in the form bound to a managed property value or assigned a managed bean method in valueChangeListener have their request values being submitted, processed and validated by the server. Assuming that the validation phase is successful, those submitted values are passed to the UPDATE_MODEL phase where each valueChangeListener method will be called.

    Basically, this method is NOT viewed as an Application Event like a Click or Change event.

    Using an Ajax submit however we can control what components in the JSF form will be submitted, and which controls will be re-rendered to display their new values after the response has been received at the client. The attribute partialSubmit however simply works in conjunction with an Ajax request to minimize the size of the ViewState and the request for performance reasons. Functionally this partialSubmit attribute alone does not have any real effect.