Cliff, I use this functionality currently. All I did was extend
ActionMapping, add my properties, and in the struts-config.xml, assigned the
type attribute of the action-mappings element my extended ActionMapping
class name. Struts will then use introspection to identify and assign the
new properties their corresponding values.

<action-mappings type="com.companyname.BaseActionMapping">

It's an easy way to extend ActionMapping class.

robert

> -----Original Message-----
> From: Cliff Rowley [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 08, 2002 10:53 PM
> To: [EMAIL PROTECTED]
> Subject: Actions and set-property
>
>
> 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
> --
>
> 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]>


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

Reply via email to