File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Proper EL Syntax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Proper EL Syntax" Watch "Proper EL Syntax" New topic

Proper EL Syntax

Jonathan Cone

Joined: May 22, 2005
Posts: 24
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

Joined: Jan 10, 2002
Posts: 60050

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.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Proper EL Syntax
Similar Threads
Why is c:forEach working
Access ArrayList Attribute Elements in EL.
Best practices question on how to set up nested objects for struts
Using attributes
Using EL to retrive data from Arraylist