I wanted to insert html code to a jsp page so I used normal spring controller populated my model with html items, then once I start to render the data on the view ,it show the user a row html tags rather than an actual elements like:
<p> <strong> Description:</strong></p>
I wanted to show the user an actual strong text not the tag itself ,anyone knows how to achieve that? my view is like that:
<%@ page isELIgnored ="false" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<body>
<c:out value="${Description}" escapeXml="false" />
</body>
</html>
any Idea how to solve it?
CodePudding user response:
You can try wrapping the field with <b>
or <h2>
tag
<%@ page isELIgnored ="false" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<body>
<b><c:out value="${Description}" escapeXml="false" /></b> // like this
</body><
/html>
CodePudding user response:
Try something like this:
<%@ page isELIgnored ="false" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<body>
<c:out value="<b>${Description}</b>" escapeXml="false" />
</body><
/html>
CodePudding user response:
try like this :
<%@ page isELIgnored ="false" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<body>
<p><b>[[${Description}]]</b></p>
</body>