There is no struts2 tag for this, OGNL has more features and more expressiveness than struts1 tags, however, there seems to be no way to check a string for either null or empty string as concisely.
The following works:
<s:if test="(myString == null || myString.equals(''))"> myString is blank or null </s:if> <s:else> The value is <s:property value="myString"/> </s:else>
The test is based on a short cycle, so the zero test cannot be changed using the equality test.
If the need to check for this often arises, a design problem may arise. With proper validation, you should not have uninitialized objects for which the view depends, but I suppose there are always exceptions.
source share