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.
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