What is the difference between the LENGTH[...] and the JSTL function fn:length(...)?
I tried to search to difference but I did not see any example that uses the first one.
Here is an example:
<c:when test="${object.field ne null || LENGTH[object.field] > 0}">
<td valign="top">
.....print something
</td>
</c:when>
Since there is no such function like
LENGTH[...]in standard JSP/JSTL/EL, it’s impossible to tell about the differences. Thefn:length()is the only way to obtain the length of aString, anObject[]orCollection.Update as per your (fixed) example:
I’ve never seen this before. It look like that your webapp/servletcontainer is using a custom EL resolver. If this is true, you should see it been declared in webapp’s
web.xmlfile.Regardless, you’d rather like to use the EL
emptykeyword here. It not only checks fornull, but also for the length of theString,Object[]orCollection.No need for
fn:length()here.The brace notation
[]is in turn by the way often used to access properties by dynamic keys. E.g.If
propertynameresolves to “foo”, then the above does effectively the same as${bean.foo}. It’s also often used onMapobjects in the scope.