You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "G.L. Grobe" <ga...@grobe.org> on 2001/03/22 05:21:42 UTC

calling getter methods

I can see that for a radio tag, the property is the name of the bean that
was mapped in the struts-config.xml file. But how does the getter method in
the action form bean actually get called, or how does the app know which
getter method to use?

I have a working example where my  action does a getXXX on the form action,
but I don't know how it got filled in and would like to understand that.

Adv(Thnxs)ance


Re: calling getter methods

Posted by Ken Beyer <ka...@metatec.com>.
Also, I found using the debug level (and adding my own
debug messages where needed) to be useful in seeing
when things are getting called.

Ken

"Craig R. McClanahan" wrote:

> On Wed, 21 Mar 2001, G.L. Grobe wrote:
>
> > I can see that for a radio tag, the property is the name of the bean that
> > was mapped in the struts-config.xml file. But how does the getter method in
> > the action form bean actually get called, or how does the app know which
> > getter method to use?
> >
> > I have a working example where my  action does a getXXX on the form action,
> > but I don't know how it got filled in and would like to understand that.
> >
>
> Basically, Struts follows rules very similar to what the standard
>
>         <jsp:setProperty name="beanname" property="*"/>
>
> tag does.  It looks at the request parameters, and matches them up with
> JavaBeans and setter methods, as long as your bean's setter methods match
> the rules in the JavaBeans specification.  In most cases, that means a
> proeprty named "foo" will look for a setter named "setFoo" -- but see the
> JavaBeans Specification for more info.
>
> > Adv(Thnxs)ance
> >
> >
>
> Craig

--
Ken Beyer
Metatec Internet Products Group
kab@metatec.com  |  http://www.metatec.com/
"The box said 'Requires Windows 95 or better.' - so I installed Linux."




Re: calling getter methods

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 21 Mar 2001, G.L. Grobe wrote:

> I can see that for a radio tag, the property is the name of the bean that
> was mapped in the struts-config.xml file. But how does the getter method in
> the action form bean actually get called, or how does the app know which
> getter method to use?
> 
> I have a working example where my  action does a getXXX on the form action,
> but I don't know how it got filled in and would like to understand that.
> 

Basically, Struts follows rules very similar to what the standard

	<jsp:setProperty name="beanname" property="*"/>

tag does.  It looks at the request parameters, and matches them up with
JavaBeans and setter methods, as long as your bean's setter methods match
the rules in the JavaBeans specification.  In most cases, that means a
proeprty named "foo" will look for a setter named "setFoo" -- but see the
JavaBeans Specification for more info.

> Adv(Thnxs)ance
> 
> 

Craig