Inserting a link in an ApexPages message

I was wondering if there’s a way to display a link in an ApexPages.Message. There’s nothing mentioned in the documentation about it, so I simply did a :

ApexPages.Message(ApexPages.Severity.CONFIRM, '<a href="/">test</a>');

It seems like the special characters are transformed to their html entity, making the link unusable.

Any known workaround?

Answer

You may need to set escape parameter to false in your VF page.

<apex:pageMessages escape="false"/> 

Attribution
Source : Link , Question Author : jpmonette , Answer Author : Richard N

Leave a Comment