如何使JSF中的Rich ToolTip可见或不可见?

时间:2013-10-10 12:34:12

标签: java jsf richfaces

我有一个关于rich的问题:toolTip组件。我有以下jsf代码:

<rich:toolTip followMouse="true" >
    <h:outputText value="#{messages.dto.Station}" escape="false" converter="bbCodeConverter" />
</rich:toolTip> 

这个工具提示工作很感激,但如果messages.dto.Station也是空的话,它将签署一个空的工具提示。如果messages.dto.Station为空,我怎么能以这种方式解决这个问题,工具提示是不可见的?

感谢您的帮助!

格尔茨 Marwief

2 个答案:

答案 0 :(得分:3)

<rich:toolTip followMouse="true" 
  rendered="#{messages.dto.Station !=null or messages.dto.Station !=''}" >
  <h:outputText value="#{messages.dto.Station}" 
    escape="false" converter="bbCodeConverter"/>
 </rich:toolTip>

使用呈现的属性可以帮助您仅在#{messages.dto.Station}不为空时显示rich faces doc link

答案 1 :(得分:0)

在JSF 1.2中,您可以使用rendered属性,如@BholaVishwakarma所描述的那样。

这应该适用于JSF 1.2

这是一个免费提示。 你应该避免在bean上使用大写字母。 messages.dto.Station。 它应该是messages.dto.station

尝试以下

<rich:toolTip followMouse="true" 
  rendered="#{messages.dto.Station !=null and not empty messages.dto.Station}">
...