This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Proper EL Syntax

 
Jonathan Cone
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi gang,

I'm using a javabean on my JSP. This bean is composed of a collection (ArrayList) and a few primitives. The problem is my (generic) ArrayList is a List of beans itself (which, of course, have properties). My question is how do I access the properties of the beans in the ArrayList using EL? I was thinking something along the lines of:


which doesn't seem to work. Any ideas? I can't seem to find much information on EL and collections, so any references would be appreciated. TIA.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If bean returns a List via a call to getArrayList(), and index is a numeric scoped variable, and the beans in the list have a getProperty() accessor, then the following syntax should do as you intend:



Note: no quotes around index.

Do you have a copy of the JSP 2.0 Specification? It's the bible as far as the EL is concerned.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic