• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EL problem

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

does EL throw ArrayIndexOutofBoundsException?
I m not getting this exception.
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic