It seems that it is not possible to use the logic tags to test "is this
property either null or an empty string?". Using <logic:present>, I can
determine that some value is present, but as far as I can tell, there is no
way to test for an empty string. Specifying value="" for tags such as
notEqual seems to result in a complaint that a required attribute has not
been specified. (Is this correct, or is this a bug in Resin, the container
I'm using?)
So, I had a couple of ideas for solving this, and I'd like to hear what
people think.
1) Modify the present and notPresent tags such that the empty string is
equivalent to null for the purposes of this test, if in fact the specified
property is a String. This might break things, though - I'm not sure.
2) Define two new logic tags - perhaps empty and notEmpty - which define
emptiness as a property being either null or the empty string. Unlike
present and notPresent, these tags would only work with the name and
property attributes (i.e. not cookie, parameter, etc), since the others
don't really make sense distinct from present and notPresent.
The second option appeals to me more, because it seems somewhat cleaner than
muddying the definition of presence to include type-specific values.
Comments, anyone?
--
Martin Cooper