Figured it out myself by checking the struts-config dtd a second time. Using
your own FormPropertyConfig class is done by setting the className attribute
on the <form-property> element.
Steven.
Steven Davelaar wrote:
> Struts 1.1 beta 2,
>
> Hi,
>
> I want to be able to set custom properties on the <form-property>
> element like this.
>
> <form-bean
> name="deptForm"
> dynamic="true"
> type="org.apache.struts.action.DynaActionForm">
>
> <form-property
> name="Deptno"
> type="java.lang.Integer">
> <set-property property="persistentAttribute"
> value="DepartmentNo"/>
> </form-property>
>
> I dived into the source code and found out that class
> org.apache.struts.config.FormPropertyConfig is used to hold this
> information. So, I assume I have to create a subclass of this class and
> add get/set methods for all my custom properties.
>
> The problem is: how do I tell Struts to use my custom
> <My>FormPropertyConfig class?
>
> I already found out the following:
>
> - Class org.apache.struts.config.ConfigRuleSet contains the information
> that instantiates the FormPropertyConfig class in method
> addRuleInstances:
>
> digester.addObjectCreate
> ("struts-config/form-beans/form-bean/form-property",
> "org.apache.struts.config.FormPropertyConfig",
> "className");
>
> - ActionServlet instantiates ConfigRuleSet in method initConfigDigester.
>
> I tried to subclass ConfigRuleSet and overwrite method addRuleInstances.
> Unfortunately, this does not compile because this method uses inner
> final classes like AddDataSourcePropertyRule and others.
>
> So, my question is: how do I drive Struts to use my own
> FormPropertyConfig class. The dtd supports custom properties on this, so
> it should be possible.
>
> In general, looking at the code in ConfigRuleSet, it would be a great
> improvement if Struts provided a simple (xml-based) override mechanism
> to all classes that are specified in ConfigRuleSet, not just
> ActionMapping.
>
> I am not on this mailing list, please reply directly to
> [EMAIL PROTECTED]
>
> Any help is greatly appreciated!
>
> Thanks,
> Steven Davelaar.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>