• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to refer dynamically object fields by using EL

 
deepan thiagu
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai everyone i need to display the Object field value by using Expression Language.
But i need to refer this Object field name dynamically by using Expression Language.
Here i don't how to use the nested Expression Language

Here my sample code is

#{fields} gives the field name of object �sample�

then how to i display �sample� field value

i try following ways

1)#{sample}.#{fields}
2) #{sample[fields]}

Please any one help me

By
Thiagu.m
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although EL can be tricky, I think in this case you're making it too hard. If you have a dictionary object ("d") and you want to access member "m" of that dictionary, I think the EL is simply "{d.m}". EL is done at run-time, and it's fairly dynamic.

Try it and see. For a fixed field, try "{d['m']}".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic