On Feb 12, 2004, at 8:53 PM, Seth Ladd wrote:
| /**
|  * @struts.validator
|  */
| public void setBar(Bar bar)
|
| it will cause it to descend the bean hierarchy adding the dots
| appropriately.

Hmm.. I tried that and doesn't look like it did the right thing. I also
looked through the source, and although I haven't quite groked all of
xdoclet's file purposes, I couldn't see any code that descended the bean
hierarchy. Maybe you wrote it and never committed it? :)

It's committed. The recursion is in StrutsValidatorTagsHandler.getFields:


private Map getFields(XClass clazz, String prefix) throws XDocletException
{
Map fields = new SequencedHashMap();


Collection curFields = clazz.getMethods(true);

// TODO: nested forms currently won't work unless
// there is a setter for it, but that is not needed
// as only the sub-forms must have setters. The top-level
// only requires a getter.
for (Iterator iterator = curFields.iterator(); iterator.hasNext(); ) {
XMethod setter = (XMethod) iterator.next();


if (MethodTagsHandler.isSetterMethod(setter)) {
if (setter.getDoc().getTag("struts.validator") != null) {
String name = MethodTagsHandler.getPropertyNameFor(setter);
XParameter param = (XParameter) setter.getParameters().iterator().next();
String type = param.getType().getQualifiedName();


if (supportedTypes.contains(type)) {
fields.put(prefix + name, setter);
}
else {
fields.putAll(getFields(param.getType(), prefix + (prefix.length() == 0 ? "" : ".") + name + "."));
}
}
}
}


        return fields;
    }

We actually use this very feature in our "legacy" Struts app in one place, so I'm sure it works for us. Ya sure you tagged the setter in the parent form bean with @struts.validator? Did you get any related output? You have to also tag the setters on the actual sub-fields you want validation on as well.

Erik



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to