2

The data shown in the table below is also displayed in my web app. With the exception of the BOOKINGNO column, which instead has an h:commandButton. The commandButton should only be rendered if the BOOKINGNO record is null on the corresponding row.

At the moment, using the code below, the buttons are not rendering.

table sample

PLOTNO SITENO ACCOMNO STARTDATE ENDDATE BOOKINGNO 16 1 10 2014-10-01 2014-10-03 <null> 21 2 2 2014-09-26 2014-09-29 923291 22 2 3 2014-10-01 2014-10-03 <null> 23 2 7 2014-09-26 2014-09-29 457235

JSF

<h:dataTable> 

    ...

    <h:column>
        <h:commandButton 
            onclick="if (!confirm('Do you want to book this holiday?')) return false"
            value="Book"
            action="#{dealsBean.book(item.plotNo)}"
            rendered="#{dealsBean.bookingNo = null}">
        </h:commandButton>
    </h:column>
/<h:dataTable>

I've tried various different rendered arguments but none seem to do what I want.

Am I getting the syntax right?

DinosaurHunter
  • 652
  • 2
  • 9
  • 23
  • Use `rendered="#{empty dealsBean.bookingNo}"` that follows both `null` as well as an empty string. – Tiny Nov 28 '14 at 15:03

1 Answers1

9

You need to use == as operator

rendered="#{dealsBean.bookingNo == null}"
Predrag Maric
  • 23,938
  • 5
  • 52
  • 68