Over a million developers have joined DZone.

How to Show Links in ADF Messages

· Java Zone

Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code! Brought to you in partnership with ZeroTurnaround.

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:

acesMessage 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);


 

The Java Zone is brought to you in partnership with ZeroTurnaround. Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code!

Topics:

Published at DZone with permission of Mohamed Sanaulla , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}