• 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

jstl access for obj.obj.member

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
I cant work out the syntax for accessing the member getter of an object of an object in a collection? e.g. objA has a member of class objB which has a member of bValue. How do I construct an EL expression that will allow me to c ut the value of the bValue? tia.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have property accessors for each of the items you wish to access?
 
Chris Pat
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
Do you have property accessors for each of the items you wish to access?



Hi
Yes I do, for both objA and objB with objB member getBValue()
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the name of the property is really "bValue" and that isn't just obfuscated, then you will have to change it. Properties whose name starts with a single lower-case character followed by an upper-case character can't be made to work properly (for reasons that I forget just now). I had the problem with a property named "eMailAddress" and when I renamed it "emailAddress" the problem went away.
 
Chris Pat
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Clapham:
If the name of the property is really "bValue" and that isn't just obfuscated, then you will have to change it. Properties whose name starts with a single lower-case character followed by an upper-case character can't be made to work properly (for reasons that I forget just now). I had the problem with a property named "eMailAddress" and when I renamed it "emailAddress" the problem went away.



Hi Paul
Thanks, but I still dont know the syntax for that second level of indirection. Lets say it is called bvalue. How would I access it

with objA(objB.bvalue) and the results=(Collection) objA
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Start from the left. You have a variable named "result". Does it have a property to get the member of class objA? If not then you're stuck. If it does, then use the property name. Repeat with the object of class objA: does it have a property to get the member of class objB? Etcetera.
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have the method getBValue() then the attribute exposed is "BValue" and not "bValue"

See the API for method "decapitalize" in the class java.beans.Introspector
 
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic