I have something like
model.addAttribute("msg", "<b>akhil</b>");
return "index";
in my Controller.
In my view page I wrote
<body>
<h2>Hello World!</h2>
<c:out value="${msg}" />
</body>
But the output is <b>akhil</b>
as against <b>akhil</b>.
Why is it so and what should be done to get <b>akhil</b>
.
No. It is not possible to have JSTL in HTML page.
JavaServer Pages Tag Library (JSTL) is a set of tags that can be used for implementing some common operations such as looping, conditional formatting, and others. Here we will be discussing how to use the Maven build tool to add JSTL support to a Spring MVC application.
The <c:out> tag is similar to JSP expression tag, but it can only be used with expression. It will display the result of an expression, similar to the way < %=... % > work.
This is because <c:out>
uses XML escaping for the characters '<'
and >
.
Set the option escapeXml=false
of c:out
to output your text in bold letters:
<c:out value="${msg}" escapeXml="false"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With