Brilliant, thanks for that Ted (and Robert Taylor).  I didn't see this
in the documentation specifically, but it was really late and I probably
just didn't see it if it was there.

At least I got the chance to poke into the Struts codebase, which I've
not really had a chance to do until now.

Thanks :)

On Mon, 2002-09-09 at 12:06, Ted Husted wrote:
> I know this is confusing, but the <action> element does not instantiate 
> an Action object. It creates an ActionMapping object (which acts like a 
> decortate for the Action). This is the object that you need to extend. 
> Then, at runtime, the controller will pass your  Action object the 
> mapping, and you can get the custom property from there. (Of course, you 
> will need to typecase the mapping first.)
> 
> The <set-property> feature is provided by the Digester, so you won't 
> find it in the Struts codebase. It's implemented in the Digester codebase.
> 
> -Ted.
> 
> 
> Cliff Rowley wrote:
> 
> > Greetings, very quick question.  From the struts config DTD, I
> > understand that action classes, like plugins, can be configured via bean
> > style properties using the <set-property> in an <action> element:
> > 
> > <quote>
> > The "set-property" element specifies the method name and initial value
> > of an additional JavaBean configuration property. When the object
> > representing the surrounding element is instantiated, the accessor for
> > the indicated property is called and passed the indicated value. The
> > "set-property" element is especially useful when a custom subclass is
> > used with <data-source>, <forward>, <action>, or <plug-in> elements. The
> > subclass can be passed whatever other properties may be required to
> > configure the object without changing how the struts-config is parsed.
> > 
> > property        Name of the JavaBeans property whose setter method
> >                 will be called.
> > 
> > value           String representation of the value to which this
> >                 property will be set, after suitable type conversion
> > </quote>
> > 
> > I've just had a stab at this but my property is not being set.  The
> > action configuration is as follows:
> > 
> > <action path="/test" type="net.onsea.huts.actions.ListAction">
> >   <set-property property="entityType" value="foo"/>
> >   <forward name="success" path="/test.jsp"/>
> > </action>
> > 
> > and my action (which is a subclass of a base action, as in Action ->
> > BaseAction -> ListAction) has a public getter/setter pair for its
> > entityType property.
> > 
> > Just wondered if this is a known issue/bug/user_error?
> > 
> > Its late (early?) and I'm not sure my blurry eyes will be much use
> > reading through the source code :|
> > 
> > Cheers
> > 
> 
> 
> -- 
> Ted Husted, Husted dot Com, Fairport NY US
> co-author, Java Web Development with Struts
> Order it today:
> <http://husted.com/struts/book.html>
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 
-- 

Regards

-------------------------------------------
 Cliff Rowley        |     [EMAIL PROTECTED]
 Software Engineer   |   www.doctype.co.uk
 +44 (0) 1206 514263 | www.cliffrowley.com
-------------------------------------------


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

Reply via email to