I might be the only living soul using <strutsvalidationxml> out there, but I probably won't be of much help since its hard to for me to put myself in your shoes and think of all this generation you're doing as it goes somewhat against the grain of my thinking.

The reason I made the <strutsvalidationxml> task work only on ValidatorForm subclasses was because that was all I need and its also metadata that goes with the form and I don't think it belongs anywhere unless it needs to be tweaked on a per-client/customer/site basis.

I'm assuming your POJO is a value-object, so now you're tagging it with view metadata. That just "smells" (in the Fowler sense) to me. I try to be judicious and carefully consider where metadata goes and putting validations on POJO's just doesn't seem like the proper fit.

But, technically what you're after should work - have a look at <XDtMethod:methodTagValue> nested within a <XDtMethod:forAllMethodTags>.

By all means keep me posted on what you end up with, as I'm curious to see how this all plays out - I'm not so set in my ways that I described above that I'm not open to learning new tricks if you come up with a good way of doing this :)

Erik



Matt Raible wrote:
I want to use the strutsform task to generate my validator forms for struts. The current struts_form.xdt gives me most of what I need, save the @struts.validator tags for each method. Is there a way to use the struts.validator tag in my pojo (plain old java object) to generate the same tag in my validator form?

I'm thinking I would need to change the struts_form.xdt template:

public void <XDtMethod:setterMethod/>( <XDtMethod:methodType/> <XDtMethod:propertyName/> )
{
this.<XDtMethod:propertyName/> = <XDtMethod:propertyName/>;
}

To contain some javadoc comments for the validator:

<XDtConfig:ifPOJOContainsValidatorStuff>
* @struts.validator type="required" msgkey="label.required"
</XDtConfig:ifPOJOContainsValidatorStuff>

Or even better, if I can grab the values from my pojo where it has:

* @struts.validator type="required" msgkey="label.required"

And my template will grab "required" and "label.required" like so:

<XDtConfig:ifPOJOContainsValidatorStuff>
* @struts.validator type="${type}" msgkey="${msgkey}"
</XDtConfig:ifPOJOContainsValidatorStuff>

Is this possible, or am I chasing a wild goose?

Thanks,

Matt


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to