gpt4 book ai didi

html - 显示时Struts2中的html标签问题

转载 作者:太空宇宙 更新时间:2023-11-04 14:23:34 25 4
gpt4 key购买 nike

嗨 我有数据库中包含 HTML 标签的数据,我正在从数据库中检索以下数据并在 UI 中显示相同的数据,但问题是我没有以粗体显示 CC6 Filament 文本,我将这两个词放在两者之间html 标签....

来自数据库的数据:

  Incandescent Lamp, <b>CC6 Filament</b> 12 Standard Package, 150 Watt, 120 Volt, PAR38, 4-5/16 Inch, Medium Side Prong, 2000 Hour, Floodlight, For Compact Flood

用于在 JSP 中显示来自数据库的上述文本的代码:shortDesc="ABOUE MENTIONED TEXT"

<p><s:property value="shortDesc" /></p>

在 Struts2 中,数据与粗体标记一起显示......

谢谢

最佳答案

默认情况下属性转义 HTML。你需要做这样的事情:

<p><s:property value="shortDesc" escape="false" /></p>

更多信息在这里:http://struts.apache.org/2.0.14/struts2-core/apidocs/org/apache/struts2/components/Property.html

关于html - 显示时Struts2中的html标签问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5752477/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com