File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes jstl access for obj.obj.member Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jstl access for obj.obj.member" Watch "jstl access for obj.obj.member" New topic
Author

jstl access for obj.obj.member

Chris Pat
Ranch Hand

Joined: Aug 27, 2005
Posts: 156
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.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61417
    
  67

Do you have property accessors for each of the items you wish to access?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Chris Pat
Ranch Hand

Joined: Aug 27, 2005
Posts: 156
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()
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18655
    
    8

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

Joined: Aug 27, 2005
Posts: 156
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
Bartender

Joined: Oct 14, 2005
Posts: 18655
    
    8

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.
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: jstl access for obj.obj.member