This reminds me of this improvement Struts was going to make a long time ago, pre 1.1 days for stxx. stxx wanted to extend the Struts config to add support for multiple xslt transformations. The problem was Struts config was stuck to a rigid DTD. A hack was introduced where you could add Digester rules to support your new config elements, but you had to either turn validation off or replace the DTD all together.

The solution, I believe, is to move to a XML schema-validated Struts config file. Give the usual Struts config a namespace to validate against. Then, allow any Struts extension the ability to define their own namespace and have their config intermingle with the normal Struts config. This allows an extension the ability to add elements and attributes wherever it wants without compromising validation. It has the added side benefit of making it possible to reduce the size of the element names, since we don't have to make them unique.

If we did this, and the code detected an old DTD-based config, we just apply an XSL transform and we have 100% backwards compatibility.

Don

Frank W. Zammetti wrote:
On Mon, February 14, 2005 2:28 pm, Don Brown said:

 - First level validation would be handled through commons-validator as
we do now.  Second level, the one where validate() code would be another
specified method, defined in the action mapping or method annotation.


This point made me think of something... What about the idea of adding the
concept of an <action-bean> in struts-config?

Instead of having a bunch of new attributes to an <action> mapping, what
if you instead define an <action-bean>, just like you define a <form-bean>
today, that declares what your validate method is, what your primary
execute() method is (if defined you treat it like a "classic" Action),
maybe what chain it should use (where Don I think was asking how to figure
out what process-* chain should be used), whatever else everyone thinks we
need.

Then, in your <action> mappings, you simply reference the appropriate
<action-bean> entry, just like <form-bean>'s are.

That might make for a nice separation, and also would allow multiple
<action> mappings to share the same Actions configured in the same way,
and all of this is done without potentially duplicating a lot of
information in each <action> mapping, especially when multiple mappings
use the same Action.



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



Reply via email to