jQuery in Action, 3rd edition
The moose likes Struts and the fly likes ActionForm and introspection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ActionForm and introspection" Watch "ActionForm and introspection" New topic

ActionForm and introspection

Celinio Fernandes
Ranch Hand

Joined: Jun 28, 2003
Posts: 549

ActionForm is based on introspection and i am wondering how exactly introspection works.

Let's suppose that i have this foo ActionForm class for a JSP that has only one text field that i call "phone":

1) the property "blah" is different from Phone : is that a problem, regarding introspection ?
2) Introspection only checks the getter and setter methods, not the properties (here "blah"), correct ?

SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCBCD 5
Visit my blog
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Your understanding is correct. The Apache Commons BeanUtils that Struts uses assumes that ActionForm follows the JavaBean rules, which includes the fact that all properties are expected to have getters and setters following certain naming conventions. BeanUtils looks only at the getter and setter, not at the instance variable.

Consultant, Sima Solutions
I agree. Here's the link: http://aspose.com/file-tools
subject: ActionForm and introspection
It's not a secret anymore!