| Author |
EL problem
|
Naresh Saw
Ranch Hand
Joined: Sep 03, 2005
Posts: 66
|
|
hi does EL throw ArrayIndexOutofBoundsException? I m not getting this exception.
|
naresh<br />SCJP 1.4(86%), SCWCD 1.4(78%)
|
 |
Chandra Atla
Ranch Hand
Joined: Jul 21, 2004
Posts: 91
|
|
Hi Naresh, It will return "null" when an ArrayIndexOutOfBoundsException is thrown. Here is an excerpt from EL chapter of JSP 2.0 spec.. 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. • If value-a is a Map, List, or array: If value-a is a Map: • If !value-a.containsKey(value-b) then return null. • Otherwise, return value-a.get(value-b) 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, return value-a.get(value-b) or Array.get(value-a, value-b), as appropriate. • 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. Thanks, Chandra Atla
|
 |
 |
|
|
subject: EL problem
|
|
|