Today we will see one of the major problem while using value binding in JSF and solution for it.Suppose if we have two fields subject1 and subject2 .In focus lost of subject2 if we try to get value of subject1 using get method it will give you null value because values are not updated using valuebinding reason for this is while we use value biding value will be updated in Update Model Value Phase and value change listener is called before Update Model Phase.
How to overcome this problem
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.
Sunday, October 3, 2010
Subscribe to:
Post Comments (Atom)
Hi Subin, Ambrish This Side.
ReplyDeleteThanks Yaar , your this post help me lot.
God Bless You.