Currently my code is like
<h:panelGroup rendered="#{templatePrescriptionMaintenanceBackingBean.allSelectedMedicationList != null && !empty templatePrescriptionMaintenanceBackingBean.allSelectedMedicationList}">
<b>List of Selected Drugs</b> // and some other stuff
</h:panelGroup>
Now allSelectedMedicationList will do lot of process in backend. Calling webservice and adding data in current DB and so on…
Now issue arise when I need to check null or empty – 2 times that method called here. Once again when I use same method with datatable it will call again 1 more time.
I think to create one method or something for JSF it self that will check null and empty at same time and return list. Is it possible?
The operator “empty” already does what you want, you don’t need to also check null.
From http://docs.oracle.com/javaee/5/tutorial/doc/bnahq.html#bnaik:
Empty: The empty operator is a prefix operation that can be used to determine whether a value is null or empty.