Question

I am rendering a date field in XHTML using JSF. Since the value in DB is saved as null the date field values is shown as "null" in the UI. How to avoid this null?

My code is given below:

    <h:outputFormat value="{0, date, MM/dd/yyyy}"
                                        rendered="#{sysbean.xx.isfeed == '1' or (sysbean.yy== false and sysbean.details.endate!= null)}">
<f:param value="#{sysbean.details.endate}" /></h:outputFormat> 

The output I am getting is

Project Name : null

How can I avoid the value coming as "null"?

Was it helpful?

Solution

<f:param value="#{value to check!=null?value when condition is true:
value when condition is false}" />

Checking the null at EL expression, or in the bean also you can put the inline check for null values.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top