How to check a boolean condition in EL?

You can have a look at the EL (expression language) description here. Both your code are correct, but I prefer the second one, as comparing a boolean to true or false is redundant. For better readibility, you can also use the not operator: <c:if test=”${not theBooleanVariable}”>It’s false!</c:if>

How to reference constants in EL?

EL 3.0 or newer If you’re already on Java EE 7 / EL 3.0, then the @page import will also import class constants in EL scope. <%@ page import=”com.example.YourConstants” %> This will under the covers be imported via ImportHandler#importClass() and be available as ${YourConstants.FOO}. Note that all java.lang.* classes are already implicitly imported and available … Read more

How do you get the length of a list in the JSF expression language?

Yes, since some genius in the Java API creation committee decided that, even though certain classes have size() members or length attributes, they won’t implement getSize() or getLength() which JSF and most other standards require, you can’t do what you want. There’s a couple ways to do this. One: add a function to your Bean … Read more

Identifying and solving javax.el.PropertyNotFoundException: Target Unreachable

1. Target Unreachable, identifier ‘bean’ resolved to null This boils down to that the managed bean instance itself could not be found by exactly that identifier (managed bean name) in EL like so #{bean}. Identifying the cause can be broken down into three steps: a. Who’s managing the bean? b. What’s the (default) managed bean … Read more

Why JSF calls getters multiple times

This is caused by the nature of deferred expressions #{} (note that “legacy” standard expressions ${} behave exactly the same when Facelets is used instead of JSP). The deferred expression is not immediately evaluated, but created as a ValueExpression object and the getter method behind the expression is executed everytime when the code calls ValueExpression#getValue(). … Read more

Evaluate empty or null JSTL c tags

How can I validate if a String is null or empty using the c tags of JSTL? You can use the empty keyword in a <c:if> for this: <c:if test=”${empty var1}”> var1 is empty or null. </c:if> <c:if test=”${not empty var1}”> var1 is NOT empty or null. </c:if> Or the <c:choose>: <c:choose> <c:when test=”${empty var1}”> … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)