c out tag escapeXml not working when its value is fetched from the Spring Model

168 Views Asked by At

I have an application that uses Spring MVC, before sending the response to the view (JSP) it adds an item to the spring model (org.springframework.ui.ModelMap), let's say the name of that item is element1 and the value is: <b>This</b> is an <br/> example

In the JSP, using a) and b) produce different results

a) <c:out value="${'<b>This</b> is an <br/> example'}" escapeXml="false"/>

b) <c:out value="${element1}" escapeXml="false"/>

a) produces

enter image description here

b) produces

enter image description here

I have been wrapping my head around this, I do not see any difference, except that b) uses a variable and a) uses the value but in both cases I am using the same tag (c:out) with the same value for the escapeXml attribute (false).

Any help will be greatly appreciated.

0

There are 0 best solutions below