The textual versions may improve readability for non-programmers, but otherwise I can't imagine any differentiators.
views:
16answers:
1
Q:
When should you use textual "or, and, not" over symbolic "||, &&, !" logical operators in JSP EL?
+1
A:
From symbolic ones the &&
is syntactically invalid in XML (JSPX, Facelets), because it's a reserved XML character. You'd prefer the textual one in EL then. Since consistency is a good thing, you'd like to do the same for other operators.
By the way, the empty
operator doesn't have a direct symbolic counterpart since it not only tests on null
, but also on empty string (or collection size). Most close would be:
${var == null && fn:length(var) == 0}
The argument for empty
would then be that it is less typing and doesn't require JSTL functions.
BalusC
2010-08-05 15:14:59