I'm trying to do a null check on a String but it won't work.
<s:iterator value="matrix" var="row">
<tr>
<s:iterator value="value" var="col">
<td>
<s:if test="%{#col==null}">0</s:if>
<s:else><s:property value="col"/></s:else>
</td>
</s:iterator>
</tr>
</s:iterator>
matrix is a
Map<Integer, List<String>>
The var "col" is correctly assigned a String value from the List.
The list may look like this [ "hello" , null , "world ]
Current output: hello world
Wanted output: hello 0 world
/Thanks in advance
Try it without the #.
<s:if test="%{col==null}">0</s:if>
I think the has will attempt to resolve 'col' first, and use the value of col as the property name. Since that'd be empty, it'd do a comparison of "" as the property name, which is the top of the value stack. I'm not sure how that would evaluate here.
I always use something like this:
<s:if test="%{licenseStatusString != null}">
... something that uses licenseStatusString
</s:if>