[OmniFaces utilities] The
getViewDeclarationLanguage()
method returns the ViewDeclarationLanguage
associated with the "current" view ID.Method:
Usage:
Starting
with JSF 2.2, we can use an explicit API for instantiating composite components
programmatically. The core of this API is based on the new createComponent() method added in the ViewDeclarationLanguage class. For getting the ViewDeclarationLanguage , you can write in JSF:
FacesContext
context = FacesContext.getCurrentInstance();
ViewDeclarationLanguage
vdl =
context.getApplication().getViewHandler().getViewDeclarationLanguage(context,
context.getViewRoot().getViewId());
But, you can
compact this via Faces#getViewDeclarationLanguage() as:
import
org.omnifaces.util.Faces;
...
ViewDeclarationLanguage
vdl = Faces.getViewDeclarationLanguage();
or,
import
static org.omnifaces.util.Faces.getViewDeclarationLanguage;
...
ViewDeclarationLanguage
vdl = getViewDeclarationLanguage();
Niciun comentariu :
Trimiteți un comentariu