Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Show Links in ADF Messages

DZone's Guide to

How to Show Links in ADF Messages

· Java Zone
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

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


 

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

Topics:

Published at DZone with permission of Mohamed Sanaulla, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}