joi, 19 martie 2015

[OmniFaces utilities (2.0)] Check if the current request is a postback


[OmniFaces utilities] The isPostback() method returns whether the current request is a postback.

Method:
See also: Faces#getContext()
Usage:

import org.omnifaces.util.Faces;
...
if(Faces.isPostback()){
   // this is a postback request
} else {
   // this is an initial request (NOT postback)
}

This a shortcut for the well-known:

FacesContext fc = FacesContext.getCurrentInstance();
if(fc.isPostback()){
   // this is a postback request
} else {
   // this is an initial request (NOT postback)
}

Niciun comentariu:

Trimiteți un comentariu