link 在 属性 内 Struts2

link inside a property in Struts2

我正在尝试在我的 jsp 页面中显示 属性:

<s:property value="News"/>

我想在新闻中放一些文字和 link

在 jsp 页面中它只显示没有 "compiling it"

的标签

我试过了

This is a news follow the <s:a href="http://www.google.it">link</s:a>

This is a news follow the <a href="http://www.google.it">link</a>

这是怎么做到的?

This is a news follow the <s:a href="http://www.google.it">link</s:a>

这是行不通的,因为你不能嵌套 Struts 标签,因此它会变成:

<s:property value="This is a news follow the <s:a href="http://www.google.it">link</s:a>"/>

这是无效的。

第二个改为:

This is a news follow the <a href="http://www.google.it">link</a>

将导致

<s:property value="This is a news follow the <a href="http://www.google.it">link</s:a>"/>

这是有效的,但将在 JSP 中以纯文本翻译。

要获得真正的HTML对象,需要禁用HTML转义功能:

<s:property value="news" escapeHtml="false" />