I have a requirement to concatenate a list of Strings using Java EL. Please note that this is not in a JSP/Web context, but in a standalone Java client (using juel-2.2.4.jar).
The expression is of the form:
${for(int i=1; i<Employees.length; i++){Employee[i].Name + "--" }}
I already have a custom ELResolver which understands Employee objects.
The output I am expecting is a String with the names of all employees with a separator in between.
Is this even possible in a standalone Java EL application?
You probably have to make a helper function, afaik, there is no way java can handle this with an expression out of the box.
Code in the
Employeeclass:Here’s dynamic example using reflection:
Usage would be: