1

Below is the my code snippet:

    String message = "Sample Message :\n Hello World";

    FacesMessage facesMsg = new FacesMessage();
    facesMsg.setSeverity(FacesMessage.SEVERITY_ERROR);
    facesMsg.setSummary(message);
    FacesContext.getCurrentInstance().addMessage(
            invokeEvent.getComponent().getClientId(
                    FacesContext.getCurrentInstance()), facesMsg);

Desired output:

Sample Message :
Hello World

Actual output:

Sample Message : Hello World

In our mbean, we are using complete java coding. Please note that normally in Java, \n works correctly as a newline character. However, facescontext is not recognizing this.

I am trying this in ADF which is part of OIM (Oracle Identity Manager). ADFis very tightly coupled in this and there are lot of limitations when we try any customizations. So, using CSS or JSF/ADF UI tags may not be feasible, as suggested in How do I add HTML code to JSF FacesMessage.

Community
  • 1
  • 1
  • Can you try
    (break in HTML) instead of /n in the message string and let us know.
    – Sid Jan 06 '16 at 13:49

2 Answers2

4

Create a fully formatted HTML for your message and pass it to your setSummary() method as shown below .

fm.setSummary("<html><body><p>Helloooo !!</p><p>Sid</p></body></html>");

This will work .

-Sid

Sid
  • 471
  • 1
  • 6
  • 19
-1

You can use HTML in your FacesMessage to change line , color and style of text Check- http://www.awasthiashish.com/2014/05/adf-basics-how-to-use-facesmessage-to.html