struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Davelaar <>
Subject How to use my own FormPropertyConfig class
Date Tue, 03 Sep 2002 08:04:51 GMT
Struts 1.1 beta 2,


I want to be able to set custom properties on the <form-property>
element like this.


      <set-property property="persistentAttribute"

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


- 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. Even if I wouldn't have run into the problem of the inner
final classes, I have to duplicate a lot of code in the two methods I
need to overwrite (addRuleInstances and initConfigDigester).

Any help is greatly appreciated!

Steven Davelaar.

View raw message