Thursday, February 20, 2014

Display messages from the backing bean programmatically

        if(condition ){
        String messageText = " Message to be displayed";
        FacesMessage fm = new FacesMessage(messageText);
        // set the severity of the message
        fm.setSeverity(FacesMessage.SEVERITY_INFO);
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, fm);
    }

No comments:

Post a Comment