JSF: h:outputText; how to show a dash when the value is empty string?

前端 未结 1 542
[愿得一人]
[愿得一人] 2020-12-30 23:02

I\'m using h:outputText tags to display readonly data. Ex:




        
相关标签:
1条回答
  • 2020-12-30 23:49
    <h:outputText value="#{userHandler.user.phoneNumber != null 
        ? userHandler.user.phoneNumber : '-'}" />
    

    Or, you could make a new outputText:

    <h:outputText rendered="#{userHandler.user.phoneNumber == null}" value="-" />
    
    0 讨论(0)
提交回复
热议问题