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>

Concatenate strings in JSF/JSP EL and Javascript [duplicate]

Assuming you are using Facelets, here’s a relatively good solution: create functions.taglib.xml in your WEB-INF add a context param indicating the location: <context-param> <param-name>facelets.LIBRARIES</param-name> <param-value> /WEB-INF/functions.taglib.xml </param-value> </context-param> In the xml put the following: <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE facelet-taglib PUBLIC “-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN” “https://facelets.dev.java.net/source/browse/*checkout*/facelets/src/etc/facelet-taglib_1_0.dtd”> <facelet-taglib xmlns=”http://java.sun.com/JSF/Facelet”> <namespace>http://yournamespace.com/fnc</namespace> <function> <function-name>concat</function-name> <function-class>com.yourpackage.utils.Functions</function-class> <function-signature> java.lang.String … Read more

Format Date output in JSF

Use <f:convertDateTime>. You can nest this in any input and output component. Pattern rules are same as java.text.SimpleDateFormat. <h:outputText value=”#{someBean.dateField}” > <f:convertDateTime pattern=”dd.MM.yyyy HH:mm” /> </h:outputText>

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 concatenate Strings in EL expression?

If you’re already on EL 3.0 (Java EE 7; WildFly, Tomcat 8, GlassFish 4, etc), then you could use the new += operator for this: <h:commandButton … action=”#{someController.doSomething(id += ‘SomeTableId’)}” /> If you’re however not on EL 3.0 yet, and the left hand is a genuine java.lang.String instance (and thus not e.g. java.lang.Long), then use … Read more