1

I have created properties file and configured all the verbiage in the that property file. I need to add the text which will be having the link. For e.g. Text is Please Contact Us. This text i have mention in the property file but I need to add the link on Contact Us.

I have mention the below key in property file

contact_us_link= Please <a href="sample.html">Contact Us</a>

On the form i should get link, but whatever i have added in the properties file same text is displaying on the form. can you please help how can i add the link in the property file.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user2625662
  • 21
  • 1
  • 3
  • It is happening because at some point between the properties file and your form, HTML special characters are being escaped (or the output isn't actually being interpreted as HTML - cannot tell from your info, for all we know you're rendering it as text/plain). Can you show us how you are reading the properties file, what you are doing with the value read from the properties file, how you are writing it to the form, and describe what "the form" is? – Jason C Aug 08 '13 at 04:13
  • Form means XHTML. I am reading the property file using JSF. with this code i am just taking the verbiage from the property file and displaying on the xhtml. – user2625662 Aug 08 '13 at 05:43

1 Answers1

4

The <h:outputText> by default escapes HTML entities as part of XSS attack prevention.

If you can guarantee that the value does not contain any user-controlled input such as username and so on, then you can use escape="false" to disable HTML escaping.

<h:outputText value="#{msg['contact_us_link']}" escape="false" />
Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555