• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL problem

 
Naresh Saw
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

does EL throw ArrayIndexOutofBoundsException?
I m not getting this exception.
 
Chandra Atla
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic