On 6 Nov 2003, at 00:43, matt wrote:
You could also use ${empty(outputDir)}, or ${outputDir == null}, which are both identical in meaning to ${empty outputDir}.
Not quite, empty(outputDir) is also true if outputDir == ""
Jelly uses the Jexl Expression Language, which is a superset of JSTL (Java Standard Tag Library). To quote from JSTL in Action,
"The empty operator determines whether a collection or string is empty or null. For instance, ${empty param.firstname} will be true only if a request parameter named firstname is not present. JSTL expressions can also compare items directly against the keyword null, as in ${param.firstname == null}, but this is an advanced use."
Although Jelly is not always in a web context (ie, doesn't have the param implicit object), the same rules apply. In addition, to quote from the jexl home page (http://jakarta.apache.org/commons/jexl.html):
Jexl has extended the JSTL in a few ways :
- Support for invocation of any accessible method (see example above).
- Added a general size() method, which works on String, returning length, Map, returning # of keys, and List and arrays, returning the number of elements.
- Optional syntax for the 'empty' function : empty(obj)
- Misc : '+' has been overloaded to be use as a String concatenation operator
The "invocation of any accessible method" means that you can call ${object.getProperty()}, and it will be the same as ${object.property}, or ${object.setProperty(someOtherObject)}. You can also call methods that do not correspond to properties, such as ${someString.endsWith(otherString)}.
Strongly recommend reading up on Jexl and JSTL.
Good answer Matt :)
James ------- http://radio.weblogs.com/0112098/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]