Frage

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.

War es hilfreich?

Lösung 2

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.

Andere Tipps

It is probably happening because <ice:selectInputText> intial values are NULL and first partial or full submit will result in EMPTY string being submitted from the page.

Intialize your selectInputText with empty Strings to avoid this or you can add below in JSF 2.x,

<context-param>
    <param-name>
         javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
    </param-name>
    <param-value>true</param-value>
</context-param>

Also to add to the Icefaces , Its partial submit is bit confusing . It is more like a Full Ajax Submit with partial Ajax/DOM rendering. There are several cases where icefaces 1.8 will execute multiple components on the page , however it avoids it in datatable column,panelSeries etc.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top