mardi 26 avril 2016

Using Ternary Operator to implement else if in EL - jsf

I have an application being developed in jsf 2.0, primefaces and using Eclipse Kepler IDE. I need to display a string value in dataTable for long value. There could be 6 possible values from 1 to 6. i have followed this question to solve my issue but i cant. my code snipped is

  <p:dataTable var="student" value="#{studentBean.studentList}">
  <p:column headerText="Class">
    <h:outputText value="#{student.studentClass == 1? 'One' :
                           student.studentClass == 2? 'Second' :
                           student.studentClass == 3? 'Third' :
                           student.studentClass == 4? 'Fourth' :
                           student.studentClass == 5? 'Fifth':
                           student.studentClass == 6? 'Sixth':''}" />
  </p:column>
      ....

i also tried:-

   student.studentClass.equals(1l) and  student.studentClass.equals(1L)

but no luck. What am i doing wrong

Aucun commentaire:

Enregistrer un commentaire