JSF: h: outputText; как показать тире, когда значение - пустая строка?

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

<h:outputText value="Phone Number:" />
<h:outputText value="#{userHandler.user.phoneNumber}" />

When "phoneNumber" is an empty string or a null, I want to display a dash "-" as the value.

Is there any easy way to do this maybe with expression language or something?

BTW, I thought about adding methods to the User class like getPhoneNumberDisplayText() that could do the check internally, but I since it's a view issue, I'd rather keep the code in the JSF page.

22
задан Bozho 24 January 2011 в 22:45
поделиться