On Feb 12, 2004, at 3:23 PM, Seth Ladd wrote:
I have a simple Struts formbean with a nested bean. For instance:

public class Foo {
~    public Bar getBar();
~    public void setBar(Bar bar);
}

public class Bar {
~    public String getX();
~    public void setX(String x);
}

Is there a way to use xdoclet's really nice validator tags to somehow
indicate the validation requirements for the nested bean's properties?

Why thank you!


The trick is (and it's been a while since I tried it, but this is the way I coded it...) if you tag your bean setter like this:

/**
 * @struts.validator
 */
public void setBar(Bar bar)

it will cause it to descend the bean hierarchy adding the dots appropriately.

Hope that works for you, cause if it doesn't you'll be mostly on your own since I'm a very happy Tapestry coder now :)

Erik

And I'd like to tell the validation scheme that bar.x is required.  If
xdoclet is only picking up validation tags from Foo, I'm not sure this
is possible.

Tag your setX as you would normally if it wasn't a nested bean.


The recursion is a very cool feature that is certainly underutilized and probably took me an extra day to code. But it's there!

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