Render HTML unescaped in a JSP page -
i've field on db contains html text , need print jsp page. how can render html? using <c:out value="${text}" /> can see text html tags. in other words, escaping html.
the <c:out> default escapes xml entities <, >, &, " , ' prevent xss attacks.
so solve problem, either don't use <c:out> (works on jsp 2.0 , newer):
${text} or add escapexml="false" attribute:
<c:out value="${text}" escapexml="false" /> you need ensure html trusted, or easy xss attack hole. jsoup may helpful in this, see xss prevention in jsp/servlet web application.
Comments
Post a Comment