< h:outputtext>按原样打印HTML,而不是实际的HTML [英] <h:outputtext> prints HTML as-is instead of actual HTML

查看:133
本文介绍了< h:outputtext>按原样打印HTML,而不是实际的HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JSF 1.2

I am using JSF 1.2

我正在尝试使用<h:outputtext>

<h:outputText id="warningDose" styleClass="redText" value="#{templatePrescriptionMaintenanceBackingBean.doseWarningText}"></h:outputText>

现在,此变量包含带有html标签的文本. <b><i>等...

Now this variable contains text with html tags. <b>,<i> etc...

但这会按原样显示内容,而不是实际的粗体或斜体html输出.

But that displays content as it is instead of actual bold or italic html output.

有什么办法可以使此<h:outputText>产生html响应吗?

Is there any way we can make this <h:outputText> such that it gives html response?

推荐答案

您应在h:outputText标记中进行设置:

You should set in the h:outputText tag:

escape="false"

但是请记住,在JSF视图页面和基础bean之间混合使用视图"构造(即使用HTML标签创建字符串)是一种不好的做法.所有的查看作品"都应该在查看页面中.

But remember that mixing "view" construction (i.e., creating a string with HTML tags) between the JSF view page and the underlying bean is kinda bad practice. All the "view production" should be in the view page.

这篇关于&lt; h:outputtext&gt;按原样打印HTML,而不是实际的HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆