• Post Reply Bookmark Topic Watch Topic
  • New Topic

Would this be possible in EL?

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class A
{
int x;
}


public class B
{
A a;
}


I want to access A's attribute. If it's private, then I could have a getter method to do that for me(I've tried it before). What I need to do is call A's member but I'm kind of worried since EL's syntax is something like...


${b.a}


I was wondering if...


${b.a.x} be possible?
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Timothy Sam:
public class A
{
int x;
}


public class B
{
A a;
}


I want to access A's attribute. If it's private, then I could have a getter method to do that for me(I've tried it before). What I need to do is call A's member but I'm kind of worried since EL's syntax is something like...


${b.a}


I was wondering if...


${b.a.x} be possible?


Nesting is possible.
So go ahead.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Private or not, you would need to crate accessors.
EL uses the bean syntax for accessing an object's fields.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:
Private or not, you would need to create accessors.
EL uses the bean syntax for accessing an object's fields.
 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, thank you, thank you everyone!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!