How to check equalIgnoreCase in EL?
String a = "hello";
a.equalsIgnoreCase("hello");
Now on JSP page..
<h:panelGroup rendered="#{patientNotePrescriptionVar.prescriptionSchedule == patientNotePresBackingBean.sendPrescription}">
... Some code here ....
</h:panelGroup>
Is there any way to compate patientNotePresBackingBean.sendPrescription
as equalIgnoreCase?
If you're using EL 2.2 (part of Servlet 3.0) or JBoss EL, then you should be able to just invoke that method in EL.
<h:panelGroup rendered="#{patientNotePrescriptionVar.prescriptionSchedule.equalsIgnoreCase(patientNotePresBackingBean.sendPrescription)}">
If you're not on EL 2.2 yet, then your best bet is passing both strings through JSTL fn:toLowerCase()
(or fn:toUpperCase()
) and then comparing it.
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
...
<h:panelGroup rendered="#{fn:toLowerCase(patientNotePrescriptionVar.prescriptionSchedule) == fn:toLowerCase(patientNotePresBackingBean.sendPrescription)}">
Better, however, would be to not make them case sensitive. If they represent some kind of constants, better make them enums or something.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With