Site icon Experiences Unlimited

How to show links in ADF Messages

In ADF we show popup/inline messages using af:messages tag or popup messages using af:document. The actual code which populates the message is:

FacesMessage fMsg = new FacesMessage("Some Message");
FacesContext fContext = FacesContext.getCurrentInstance();
fContext.addMessage("",fMsg);

The above code shows the message at INFO Severity. What if we want to add a link in the message we show? For that we would have to wrap the complete message within html tags. Let modify the above message to add a link to some webpage.

String htmlMessage = "<html>Some Message. "+
           "Goto <a href=http://www.google.com>Google</a></html>";
FacesMessage fMsg = new FacesMessage(htmlMessage);
FacesContext fContext = FacesContext.getCurrentInstance();
fContext.addMessage("",fMsg);


This is one of the ways to show any links in your messages.

Exit mobile version