Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

do bean fields have to be public to use reflection?

Status
Not open for further replies.

dendenners

Programmer
Jul 17, 2001
110
IE
Hey there,
I'm using the java reflection package to dynamically determine what fields of a dataObject (bean) to show on jsp page. However, it seems that I get an error if the member variables of the bean are private. Is it the case that member variables of a class have to be public for reflection to determine them, or is there a bean-specific way in which a correctly constructed class can get around this?
Thanks
 
As was stated earlier post, Reflection does not bypass the basic accessiblity security. You can still only see public members.
 
I've solved this problem. Instead of accessing the member vars directly I just invoked the public get() methods for the variables.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top