How to correctly display HTML markup content from database to browser in Struts 2?
I have a simple text stored in a database record: Hello
wrapped in a tag h1
.
When I print this post to a JSP with a tag <s:property />
, it displays:
<h1>Hello</h1>
For now, I want it to display like this:
Hello
How do I get the interpreted value instead of the original value?
+3
Đào Duy Tùng
source
to share
1 answer
You need to set the escapeHtml
tag attribute <s:property/>
to false
, because for security reasons it true
is the default:
<s:property value="myVar" escapeHtml="false" />
More details in the docs .
+2
Andrea Ligios
source
to share