Change ValueChangeListener’s behavior in JSF
There are two types of listners in the JSF,
1 ValueChangeListner
2 ActionListner
The value change listner baves in a special manner, value change lisner gets call before updatemodel phase, So model will not get update. At this point of time we need to do some operations based on the use entered values. For this there many ways to update values.
1 By using findcomponent, get the component and manually updates the value
2 Servlet Request parameter
3 Explicitly invoke model Phase
Invoking model Phase
PhaseId phaseId = evt.getPhaseId();
if (phaseId.equals(PhaseId.ANY_PHASE)) {
evt.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
evt.queue();
return;
}
Place the above code at the beginning of the method, So automatically updates all the values of the submitted form.
