• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to refer dynamically object fields by using EL

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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']}".
reply
    Bookmark Topic Watch Topic
  • New Topic