public void showMessageDynamic(FacesMessage message, boolean escape) {
            String summary = EscapeUtils.forJavaScript(message.getSummary());
            String detail = EscapeUtils.forJavaScript(message.getDetail());

            executeScript("PrimeFaces.showMessageInDialog({severity:\"" + message.getSeverity()
                    + "\",summary:\"" + summary
                    + "\",detail:\"" + detail
                    + "\",escape:" + escape + "});");
        }
Displays a message in a dynamic dialog with escape control.

@param message the {@link FacesMessage} to be displayed.
@param escape true to escape HTML content, false to display HTML content
primefaces/src/main/java/org/primefaces/PrimeFaces.java