Not sure if it's *explicitly* part of any official docs, but it can be inferred
from the struts-config DTD. The comment for <action> includes:

The "action" element describes an ActionMapping object...

The comment for <set-property> includes:

When the object representing the surrounding element is instantiated, the
accessor for the indicated property is called and passed the indicated value.

Quoting Jim Barrows <[EMAIL PROTECTED]>:

> > -----Original Message-----
> > From: news [mailto:[EMAIL PROTECTED] Behalf Of Bill Siggelkow
> > Sent: Friday, September 03, 2004 10:08 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: ARRRGGGGHHHH!!! I'm being stupid again....
> > 
> > 
> > The <set-property> in nested <action> applies to the ActionMapping 
> > object not the Action.
> 
> Oh that makes sense in a SCO kind of way.......
> 
> Just so I can bookmark that info... where did you find it?
> 
> > 
> > Jim Barrows wrote:
> > > I'm trying to use the set-property tag in the struts-config 
> > file.  I know I'm being stupid, but what exactly is it?
> > > It's not finding the property to set.
> > > 
> > > Okay if I have in my struts-config.xml:
> > > <action name="loanForm" path="/loanAppWizard"     
> > type="com.sssc.shtuff.actions.LoanAppWizardAction" scope="session">
> > > 
> > >   <set-property property="maxNumberOfPages" value="2" />
> > > 
> > >   <forward name="page1" path="/demographics.jsp"></forward>
> > >   <forward name="page2" path="/references.jsp"></forward>
> > >   <forward name="done" path="/done.jsp"></forward>
> > > </action>
> > > 
> > > and this in my action class:
> > > public class LoanAppWizardAction extends Action {
> > > 
> > >   blah
> > > 
> > >     /**Read only property from inside this action that 
> > indicates what number is
> > >      * the last page.
> > >      */
> > >     private int maxNumberOfPages = 0;
> > > 
> > > Lots o' blah
> > >                     
> > >     /**
> > >      * @return
> > >      */
> > >     public int getMaxNumberOfPages() {
> > >         return maxNumberOfPages;
> > >     }    
> > >     
> > >     public void setMaxNumberOfPages(int i) {
> > >         maxNumberOfPages = i;
> > >     }
> > > }
> > > Then I should end up with maxNumberOfPages set to 2, and not:
> > > The following exception was logged 
> > java.lang.NoSuchMethodException: Bean has no property named 
> > maxNumberOfPages

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to