struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Volker Krebs <volker.kr...@abas.de>
Subject Re: Work in progress - 2.3.16
Date Tue, 19 Nov 2013 14:27:01 GMT
Am 18.11.2013 20:21, schrieb Lukasz Lenart:
> 2013/11/18 Volker Krebs <volker.krebs@abas.de>:
>> Maybe something for the Migration Guide.
>> Accessing a map has changed a bit.
>>
>> With 2.3.15.3 the following did work:
>> <s:property value="#item.content[number]" />
>>
>> With 2.3.16 you have to write:
>> <s:property value="#item.content['number']" />
>
> You mean that the 'numer' is a static key not an expression (resolved
> to getNumber())? Anyway, thus is strange.
>
>
> Regards
>

Ok, got it.
<s:if test="#item.content[key] != null">
</s:if>
In 2.3.15.3 it returns true.
In 2.3.16 it returns false.

This is because I was accessing the map wrong (arghhh ... OGNL, after so 
many years still unhandleable)
In 2.3.15.3 a new map entry with key null and value '' is created 
somewhere in the struts2 stack. And #item.content[key] evaluates to 
#item.content[null] which returns ''.

In 2.3.16 the new map entry is not created. And #item.content[key] 
always returns null without creating a new map entry.

Regards.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message