简体   繁体   English

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

[英]How to makes a Rich ToolTip in JSF visible or not visible?

i have a question concerning rich:toolTip component. 我有一个关于rich:toolTip组件的问题。 I have the following jsf code: 我有以下jsf代码:

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

This ToolTip works grateful, but it will be sign a empty tooltip, if messages.dto.Station is empty too. 此工具提示非常有用,但如果messages.dto.Station也为空,则它将是一个空的工具提示。 How can i solve this problem in that way, that the tooltip is not visible, if messages.dto.Station is empty? 如果messages.dto.Station为空,我该如何解决该问题,使工具提示不可见?

Thanks for helping me ! 感谢您的帮助!

Greetz Marwief 格蕾兹·马维夫(Greetz Marwief)

<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>

Using the rendered attribute will help you to only show when your #{messages.dto.Station} is not empty rich faces doc link 使用rendered属性将帮助您仅在#{messages.dto.Station}不为空时显示Rich Faces文档链接

In JSF 1.2 you can use the rendered attribute as @BholaVishwakarma has described. 在JSF 1.2中,可以使用@BholaVishwakarma描述的rendered属性。

That should work on JSF 1.2 also 那也应该适用于JSF 1.2

Here is a free tip for you. 这是给您的免费提示。 You should avoid using uppercase letters on beans. 您应该避免在bean上使用大写字母。 messages.dto.Station . messages.dto.Station It should be messages.dto.station 它应该是messages.dto.station

Try the following 尝试以下

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM