[OmniFaces utilities] The
addGlobal()
method adds a global faces message. This adds a faces message to a client ID of null
.Method:
See also: Faces#getContext()
Usage:
We can use
the Messages#addGobal() to add a
global message, as below:
<h:messages/>
<h:form
id="loginFormId">
E-mail: <h:inputText id="emailId"
value="#{loginBean.email}"/>
Pass: <h:inputSecret
id="passwordId" value="#{loginBean.password}"/>
<h:commandButton id="submitId"
value="Login" action="#{loginBean.loginAction()}"/>
</h:form>
import
org.omnifaces.util.Messages;
...
FacesMessage
message = new FacesMessage();
message.setSummary("E-mail
not allowed!");
message.setDetail("Only
Yahoo and Gmail domains are supported so far!");
message.setSeverity(FacesMessage.SEVERITY_ERROR);
Messages.addGlobal(message);
Niciun comentariu :
Trimiteți un comentariu