Wednesday, March 19, 2014

String comparision ignoring case in EL

It's a common requirement , to show/hide links basing on a string comparision ignoring case.

Though we can achieve this with a transient attribute by keeping the logic in it's getter method, I felt using JSTL tags is a simple way to implement .

Steps:
- Add JSTL Functions Tag Library to the project
- Add JSTL functions namespace to the jspx page:

Eg. xmlns:fn="http://java.sun.com/jsp/jstl/functions"

- Change your EL to

rendered="#{fn:toLowerCase(securityContext.userName) ne fn:toLowerCase(node.CreatBy)}"

You can follow this link for using JSTL in ADF Faces, click here