Messages & Dialogs
Components for messages and dialogs are included in the XHTML templates. Those components can be activated for the whole application by a single configuration entry.
Messages¶
The parent classes of generated ‘[layout‑Name]Bean’ classes contain methods in the form of
addMessage(...)
addWarningMessage(...)
addErrorMessage(...)
addValidationMessage(...)
All those methods in the end call facesContext.addMessage(null, ...)
.
The first parameter of that call, an optional client id, is always null. The provided message
is automatically going to be displayed in a <p:growl>
or a <p:messages>
component.
You can activate a <p:growl>
and a <p:messages>
tag in the templates by setting a context parameter layout.growlPerPage
and layout.messagesPerPage
to true
in the web.xml file.
Info
There is more modeling and generation support planned for messages. With this all possible messages that can occur while interacting with a web page will be defined. You will get a generated enumeration and corresponding entries in properties files for i18n purposes.
Dialogs¶
Info
There is not yet any modeling and generation support for dialogs.
If you want to use a dialog you can use the PrimeFaces components <p:dialog>
and <p:confirmDialog>
and also the “PrimeFaces Dialog Framework”.