Saturday, October 6, 2012

JSF: setting EL expression programmatically

Issue
Create a JSF component programmatically and setting a property dynamically (eg disabled, visible, etc).

Solution
Java Server Faces provides an expression language (JSF EL)  used in web application pages to access the JavaBeans components in the page. It is possible to set it programmatically using a javax.el.ValueExpression, an abstract class that provides the API for the Unified Expression Language.