luni, 30 martie 2015

[OmniFaces utilities (2.0)] Get the current UI component from the EL context


[OmniFaces utilities] The getCurrentComponent() method returns the current UI component from the EL context.

Method:
Usage:

import org.omnifaces.util.Components;
...
UIComponent currentComponent = Components.getCurrentComponent();

This method return the UIComponent instance that is currently processing. For example, OmniFaces uses this method to obtain the current component that causes a constraint violation in the JsfLabelMessageInterpolator (custom message interpolator):
...
if (hasContext()) {
    label = getLabel(getCurrentComponent());
}
...

Niciun comentariu:

Trimiteți un comentariu