Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I access a HashMap using Expression Language

Tags:

el

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?

like image 900
Marcos Roriz Junior Avatar asked Dec 12 '10 22:12

Marcos Roriz Junior


1 Answers

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

${doctors[appointment.docID]} 
like image 164
Bozho Avatar answered Mar 06 '23 20:03

Bozho



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!