[英]need to show HTML in jsp using struts tagLib
I am working on a Java (Struts)
based web application. 我正在研究基于
Java (Struts)
的Web应用程序。 I have to show some content by getting from DB in jsp. 我必须通过从jsp中的DB获取来显示一些内容。 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: 我现在正在使用
textarea
,但是当我使用以下标记将其放入textarea
:
<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. 它显示了textarea中的HTML,是否有任何方式可以显示没有HTML标签的
textarea
的内容,也可以显示其他任何标签(如P
或span
,我也无法在struts tagLib中找到这些标签。
The <html:xxx>
tags are for forms. <html:xxx>
标记用于表单。
The best practice is to use JSTL's <c:out>
with an appropriately-scoped object (eg, a request attribute) and set escape
to false: 最佳实践是将JSTL的
<c:out>
与适当作用域的对象(例如request属性)一起使用,并将escape
设置为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 . 另外,如果您使用的是过时的容器或没有其他更好的方法,请使用
<bean:write>
标记 。 I don't recall its escaping behavior(s), if any. 我不记得它的转义行为(如果有)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.