Struts 2转义html无法正常工作?

编程入门 行业动态 更新时间:2024-10-22 08:31:50
本文介绍了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无法正常工作?

本文发布于:2023-11-26 07:00:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1633102.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:无法正常   工作   Struts   html

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!