See reasoning below...
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]] On Behalf
> Of Erik Hatcher
> Sent: Sunday, December 08, 2002 7:21 PM
> To: Matt Raible
> Cc: [EMAIL PROTECTED]
> Subject: Re: [Xdoclet-devel] Generating Validator Forms
>
>
> 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.
>
My POJO was just that, a plain old java object that didn't extend
anything. However, today I discovered that it had to extend EntityBean
and I had to use @ejb tags in order to generate a struts.form from it.
That's the part that smells to me ;-) Anyway, my idea is thus - to use
this class to generate a StrutsForm, complete with struts.validation
tags as specified, and then to generate the JSP and .properties file
based on your strutsgen tool. At the same time, I'm marking up the same
EntityBean with hibernate (and eventually castor) tags to generate the
persistence classes. I think I'm going to have to create an interface
DAO to separate out the different options, but if I didn't care, I'm
sure I could call hibernate methods directly in my code.
I believe there will be some duplication between the hibernate objects
and my struts forms - but that's how it should be - one for the UI and
one for the data tier. Hopefully I can use BeanUtils.copyProperties to
get information back and for the between the two.
On my current project, I used a code generator to generate DAO's, VOs
and StrutsForms. While it worked great for generating initial code, it
seemed to require a lot of maintenance to add a new column. I would
have to modify 3 different classes to add 1 stinkin' column. So I'm
generally trying to improve the method I've used in the past, and I'm
hoping that by using one class, I can generate these 3 classes by adding
one new getter/setter. It might work, it might not - there's only one
way to find out!
> But, technically what you're after should work - have a look at
> <XDtMethod:methodTagValue> nested within a
> <XDtMethod:forAllMethodTags>.
>
I'll take a look - thanks.
Matt
> 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
>
-------------------------------------------------------
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