I have been in the software development industry since 2010, working on enterprise product development using ADF. I am usually keen on learning about software design and emerging technologies. You can find me hanging around in the JavaRanch Forums where I am one of the moderators. Apart from Java, I am fascinated by the ease of use and simplicity of Ruby and Rails. Mohamed is a DZone MVB and is not an employee of DZone and has posted 57 posts at DZone. You can read more from them at their website. View Full User Profile

How to Show Links in ADF Messages

05.20.2013
| 2126 views |
  • submit to reddit

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


 

Published at DZone with permission of Mohamed Sanaulla, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags: