From spec 2.0 page 104,
To evaluate expr-a[expr-b]
� Evaluate expr-a into value-a
� If value-a is null, return
null.
� Evaluate expr-b into value-b
� If value-b is null, return
null.
e.g. <% pageContext.setAttribute("testname", null); %>
${person[testname]} returns empty.. no exception
If value-a is a Map:
� If !value-a.containsKey(value-b) then return
null.
If value-a is a List or array:
� Coerce value-b to int (using coercion rules)
�
If coercion couldn't be performed: error � Then, if value-a.get(value-b) or Array.get(value-a, value-b)
throws ArrayIndexOutOfBoundsException or IndexOutOfBoundsException: return null � Otherwise, if value-a.get(value-b) or Array.get(value-a, value-b) throws
other exception, error Otherwise (a JavaBeans object), coerce value-b to
String � If value-b is a readable property of value-a, as per the JavaBeans specification:
� If getter
throws an exception: error � Otherwise: return result of getter call
� Otherwise:
error. In your example,
1) person.notProperty -- notProperty is not evulated it is directly considered as property (value-b) of teh bean and applies above last rule..
2)person["notProperty"] -- same as above
3) person[notProperty] -- here notProperty is considered expr-b and try to find in 4 scopes, since it is not existed, returns null as the value.. here applies first rule given in above spec..
Hope this helps.. let me know if i am wrong..
Radmika