How can I access a HashMap using Expression Language
Asked Answered
B

1

17

I'm having some problems on manipulating data in EL / JSP.

I have two variables in my Action (I'm using Struts2 btw) they are:

private List<Appointment> appointment;
private Map<Integer, String> doctors;

Appointment has the attribute docID and the doctors list uses this to identify the Doctor full name; I want in my JSP to get the doctor full name. That is, I want this:

${doctors[${appointment.docID}]} 

However this dont work. Any idean on how to get this working?

Broadbill answered 12/12, 2010 at 22:37 Comment(1)
See also Java EE 5 tutorial - Examples of EL expressionsBrewmaster
D
27

You don't need to open another EL-expression. Just remove the inner-one:

${doctors[appointment.docID]} 
Dubose answered 12/12, 2010 at 22:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.