Nick Heudecker wrote:
Matt,
That won't work for dynamic forms since I'm only dealing with POJOs.
Do you know where the code lives that enforces the ValidatorForm
requirement? Maybe I can hack that up a bit.
It's at xdoclet\modules\apache\src\xdoclet\modules\apache\struts\StrutsValidatorTagsHandler.java
Matt
On Thu, 23 Sep 2004 03:58:11 -0600, Matt Raible <[EMAIL PROTECTED]> wrote:
Nick,
I tested this out tonight and was able to successfully generated rules for a Form that has a get/set on a ParentForm.
Here's how it works:
1. You have to put @struts.validator on the top-level setter. 2. The parameter that's set must extend ValidationForm or ValidatorActionForm.
So if I generate an ActionForm from a POJO that has a nested POJO - the setter ends up being:
/** * @struts.validator */ public void setPOJO(POJO pojo) { this.pojo = pojo; }
In this case, no validation.xml entries will be generated for POJO b/c it doesn't extend from a ValidationForm. If I manually change the generated file to:
/** * @struts.validator */ public void setPOJOForm(POJOForm pojo) { this.pojoForm = pojo; }
Everything works as expected. The following comment in StrutsValidatorTagsHandler was helpful too:
// 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.
Matt
Nick Heudecker wrote:
Matt:
Just tried this again and didn't have any luck.
On Wed, 22 Sep 2004 11:18:56 -0600, Matt Raible <[EMAIL PROTECTED]> wrote:
Did you try putting an @struts.validator tag (w/ no attributes) on the parent objects setter? I believe that is the workaround that Erik suggested.
Matt
On Sep 22, 2004, at 9:53 AM, Nick Heudecker wrote:
Matt,
Putting the validation tags on the nested object's properties creates validation XML, but the properties are not prefixed with the name of the parent object's property name. So you get this:
<field property="address1" depends="required"> <arg0 key="home.address.1"/> </field>
Instead of:
<field property="homeAddress.address1" depends="required"> <arg0 key="home.address.1"/> </field>
------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ xdoclet-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-devel
