Search in sources :

Example 1 with FacesMessage

use of jakarta.faces.application.FacesMessage in project rubia-forums by flashboss.

the class SplitTopic method setInfoBundleMessage.

private void setInfoBundleMessage(String bundleKey) {
    String message = getBundleMessage("ResourceJSF", bundleKey);
    getCurrentInstance().addMessage("message", new FacesMessage(SEVERITY_INFO, message, "moderate"));
}
Also used : FacesMessage(jakarta.faces.application.FacesMessage)

Example 2 with FacesMessage

use of jakarta.faces.application.FacesMessage in project rubia-forums by flashboss.

the class JSFUtil method setErrorMessage.

/**
 * @param id  the id of the error message to create
 * @param msg the text of the error message to create
 */
public static void setErrorMessage(String id, String msg) {
    FacesMessage message = new // severity
    FacesMessage(// severity
    SEVERITY_ERROR, // summary
    msg, // detail
    msg);
    getCurrentInstance().addMessage(id, message);
}
Also used : FacesMessage(jakarta.faces.application.FacesMessage)

Example 3 with FacesMessage

use of jakarta.faces.application.FacesMessage in project rubia-forums by flashboss.

the class JSFUtil method getMessage.

/**
 * @param id the id of the message to find
 *
 * @return the text of the message
 */
public static String getMessage(String id) {
    String msg = null;
    Iterator<FacesMessage> msgs = getCurrentInstance().getMessages(id);
    if (msgs != null) {
        if (msgs.hasNext()) {
            FacesMessage message = msgs.next();
            msg = message.getDetail();
        }
    }
    return msg;
}
Also used : FacesMessage(jakarta.faces.application.FacesMessage)

Example 4 with FacesMessage

use of jakarta.faces.application.FacesMessage in project rubia-forums by flashboss.

the class JSFUtil method handleException.

/**
 * @author sshah
 *
 * @param e the exception to handle
 *
 * @return the navigation state of the application
 */
public static String handleException(Exception e) {
    String genericNavState = ERROR;
    String msg = e.toString();
    FacesMessage message = new // severity
    FacesMessage(// severity
    SEVERITY_ERROR, // summary
    msg, // detail
    msg);
    getCurrentInstance().addMessage(ERROR, message);
    return genericNavState;
}
Also used : FacesMessage(jakarta.faces.application.FacesMessage)

Example 5 with FacesMessage

use of jakarta.faces.application.FacesMessage in project rubia-forums by flashboss.

the class ModeratorAction method setWarnBundleMessage.

private void setWarnBundleMessage(String bundleKey) {
    String message = getBundleMessage("ResourceJSF", bundleKey);
    getCurrentInstance().addMessage("message", new FacesMessage(SEVERITY_WARN, message, "moderate"));
}
Also used : FacesMessage(jakarta.faces.application.FacesMessage)

Aggregations

FacesMessage (jakarta.faces.application.FacesMessage)184 Test (org.junit.Test)18 FacesContext (jakarta.faces.context.FacesContext)13 ResourceBundle (java.util.ResourceBundle)11 Application (jakarta.faces.application.Application)10 ValidatorException (jakarta.faces.validator.ValidatorException)9 Test (org.junit.jupiter.api.Test)9 UIInput (jakarta.faces.component.UIInput)8 ResponseWriter (jakarta.faces.context.ResponseWriter)8 Iterator (java.util.Iterator)8 Locale (java.util.Locale)8 MissingResourceException (java.util.MissingResourceException)8 UIViewRoot (jakarta.faces.component.UIViewRoot)7 ValueExpression (jakarta.el.ValueExpression)6 FacesException (jakarta.faces.FacesException)6 ViewHandler (jakarta.faces.application.ViewHandler)5 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 UIComponent (jakarta.faces.component.UIComponent)4 ConverterException (jakarta.faces.convert.ConverterException)4