I am working on a Java (Struts)
based web application. I have to show some content by getting from DB in jsp. Example content:
<div>
some code here
<a> link here</>
</div>
I am using textarea
for the time but when I put this into textarea
using following tag:
<html:textarea property = "contentFromDB" rows = "12" cols = "70" styleClass = "textarea" disabled="true"/>
It shows the HTML in the textarea, is there any way I may show the content in the textarea
with out HTML tags or I may show the content in any other tag like P
or span
, I cannot find these tags in the struts tagLib as well.
The <html:xxx>
tags are for forms.
The best practice is to use JSTL's <c:out>
with an appropriately-scoped object (eg, a request attribute) and set escape
to false:
<c:out value="xxx" escapeXml="false" />
Alternatively if you're on an antiquated container or just have nothing better to do, use the <bean:write>
tag . I don't recall its escaping behavior(s), if any.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.