Léa Massiot
Léa Massiot

Reputation: 2018

HTML character entities replaced with characters in a JSP page

I have the following context-param element in a Tomcat Webapp web.xml file:

<context-param>
  <param-name>S_ALL_RIGHT_RESERVED</param-name>
  <param-value>Tous droits r&#233;serv&#233;s</param-value>
</context-param>

I have the following code in a JSP:

<div>
  Without cout: ${initParam['S_ALL_RIGHT_RESERVED']}
  <br />
  With cout: <c:out value="${initParam['S_ALL_RIGHT_RESERVED']}"></c:out>
</div>

If I look at the source of the page, below is what I get:

<div>
  Without cout: Tous droits réservés
  <br />
  With cout: Tous droits réservés
</div>

What I would like to get instead is:

<div>
  Without cout: Tous droits r&#233;serv&#233;s
  <br />
  With cout: Tous droits r&#233;serv&#233;s
</div>

Can you tell what's wrong? Thank you.

Upvotes: 0

Views: 194

Answers (1)

Ish
Ish

Reputation: 4154

In your web.xml, try this:

<param-value><![CDATA[Tous droits r&#233;serv&#233;s]]></param-value>

Upvotes: 1

Related Questions