Struts 2转义html无法正常工作? [英] Struts 2 escape html doesn't work?
本文介绍了Struts 2转义html无法正常工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到Struts2问题
I have a Struts2 problem,
<s:property escape="false" value="value" />
值是从数据库,内容html标签获得的,例如:
value is got from database, content html tags, Example:
TOTO<br/>Adresse:<br/>
使用带有转义符的Struts2标记时,结果为:TOTO<br/>Adress:<br/>
而不是格式正确的内容,因此有人知道如何解决此问题吗?
我尝试escapeHhtml
,escapeXML
,escape
,总是同样的问题...
我想要的结果是:
when using Struts2 tag with escape false the result: TOTO<br/>Adress:<br/>
and not the well formatted content, so anyone has an idea how to correct this?
I try escapeHhtml
, escapeXML
, escape
, always same problem...
the result that I want is like:
TOTO
Adress:
推荐答案
尝试操作中的代码
public String getValue(){
return StringEscapeUtils.unescapeHtml4(this.value);
}
然后与
<s:property escapeHtml="false" value="value" />
这篇关于Struts 2转义html无法正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文