How to compare two object variables in EL expression language?

In Expression Language you can just use the == or eq operator to compare object values. Behind the scenes they will actually use the Object#equals(). This way is done so, because until with the current EL 2.1 version you cannot invoke methods with other signatures than standard getter (and setter) methods (in the upcoming EL … Read more

how to debug JSF/EL

Closest what you can get in JSF/Facelets is placing an <ui:debug /> somewhere in the view: <ui:debug /> Pressing CtrlShiftD should then show a popup window with debug information about the component tree and all available request parameters and request/view/flash/session/application scoped variables. It’s basically a representation of the content of all those maps. The hotkey … Read more

How to create a custom EL function to invoke a static method?

First create a final class with a public static method which does exactly the job you want: package com.example; import java.util.Collection; public final class Functions { private Functions() { // Hide constructor. } public static boolean contains(Collection<Object> collection, Object item) { return collection.contains(item); } } Then define it as a facelet-taglib in /WEB-INF/functions.taglib.xml: <?xml version=”1.0″ … Read more

How to testing for enum equality in JSF?

This is actually more EL related than Faces related. The construct as you posted is valid, but you should keep in mind that enum values are in EL 2.1 or older actually evaluated as String values. If String.valueOf(mrBean.getStuff()) equals String.valueOf(mrsBean.getStuff()), then your code example will render. In EL 2.2 or newer the same construct will … Read more

null check in jsf expression language

Use empty (it checks both nullness and emptiness) and group the nested ternary expression by parentheses (EL is in certain implementations/versions namely somewhat problematic with nested ternary expressions). Thus, so: styleClass=”#{empty obj.validationErrorMap ? ‘ ‘ : (obj.validationErrorMap.contains(‘key’) ? ‘highlight_field’ : ‘highlight_row’)}” If still in vain (I would then check JBoss EL configs), use the “normal” … Read more

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