Heh, I just wrote an explanation of this on the appfuse user list
tonight: 

http://article.gmane.org/gmane.comp.java.appfuse.user/1567

In Struts, there's a two-step process.  First, ActionForms are
generated from POJOs.  The POJOs have @struts.validator on the getters
b/c all the other XDoclet tags go on getters.  The generated
ActionForm has the validator tags on the setters - because that is the
natural location of validating something (when it's set).  Of course,
since
XDoclet is open source and (as a user) you have a say in how it works
- feel free to enter a request in its JIRA instance to change this.

Matt

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf 
> Of Nevine El-Saeed
> Sent: Wednesday, September 01, 2004 12:12 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [Xdoclet-user] Strutsform
> 
> 
> Hello,
> 
> Actually I was able to get it to work...surprisingly enough, 
> the @struts.validator tag works when it is on the getter not 
> the setter!!! That is strange isn't it?
> 
> On Tue, 2004-08-31 at 17:24, Matt Raible wrote:
> > Are the @struts.validator tags on your getters (not setters) of your
> > POJO?
> > 
> > Matt
> > 
> > On Aug 31, 2004, at 2:50 AM, Nevine El-Saeed wrote:
> > 
> > > Thanks for ur help guys, I did as u advised me and I got the 
> > > struts_form.xdt and replaced the old one with it. I still got 
> > > nothing. When I tried editing that file to see if it 
> prints anything 
> > > to the generated form file, I found out that it does 
> print out whatever I
> > > write
> > > to it so the changes I made:
> > >
> > >    /**
> > >     *hello
> > >     <XDtMethod:forAllMethodTags tagName="struts.validator">
> > >     * @struts.validator <XDtMethod:methodTagValue 
> > > tagName="struts.validator"/>
> > >     </XDtMethod:forAllMethodTags>
> > >     <XDtMethod:forAllMethodTags tagName="struts.validator-args">
> > >     * @struts.validator-args <XDtMethod:methodTagValue 
> > > tagName="struts.validator-args"/>
> > >     </XDtMethod:forAllMethodTags>
> > >     <XDtMethod:forAllMethodTags tagName="struts.validator-var">
> > >     * @struts.validator-var <XDtMethod:methodTagValue 
> > > tagName="struts.validator-var"/>
> > >     </XDtMethod:forAllMethodTags>
> > >     */
> > >
> > > after I run the xDoclet, the word 'hello' is generated in the new 
> > > form file but any @struts.validator is skipped as if it doesn't 
> > > exist!
> > >
> > > Any ideas??
> > > Thanks in advance..
> > >
> > >
> > >
> > > On Mon, 2004-08-30 at 23:15, Matt Raible wrote:
> > >> The struts_form.xdt file has been modified to support generating 
> > >> validation.xml.  This is in CVS.
> > >>
> > >> Matt
> > >>
> > >> On Aug 30, 2004, at 8:22 AM, Aleksandr Shneyderman wrote:
> > >>
> > >>>
> > >>> You have to do two step generation for this, since 
> validation will
> > >>> only
> > >>> be generated off of form object not the bean that 
> generates your  
> > >>> form;
> > >>> you will also need Matt Raible's modifications of 
> Xdoclet .xdt file  
> > >>> to
> > >>> propagate your validation tags to the generated form.
> > >>>
> > >>> Search the archive on this list for more info if you 
> need it This 
> > >>> topic had been discussed a month or two ago.
> > >>>
> > >>> HTH,
> > >>> Alex.
> > >>>
> > >>>
> > >>>
> > >>> -----Original Message-----
> > >>> From: [EMAIL PROTECTED]
> > >>> [mailto:[EMAIL PROTECTED] On Behalf Of 
> > >>> Nevine El-Saeed
> > >>> Sent: Monday, August 30, 2004 10:08 AM
> > >>> To: [EMAIL PROTECTED]
> > >>> Subject: [Xdoclet-user] Strutsform
> > >>>
> > >>>
> > >>> Hello all,
> > >>>
> > >>> I use strutsform to generate the form file from an 
> entity bean. I
> > >>> can't
> > >>> seem however to do any validations on this form. My 
> Bean file is as
> > >>> follows:
> > >>>
> > >>>
> > >>> 
> //////////////////////////////////////////////////////////////////
> > >>> //
> > >>> //
> > >>> //
> > >>> /
> > >>>
> > >>>
> > >>> /**
> > >>>  *
> > >>>  * @ejb.bean name = "myBean"
> > >>>  *
> > >>>  * @struts.form name = "b"
> > >>>  * include-all = "true"
> > >>>  * extends = "org.apache.struts.validator.ValidatorForm"
> > >>>  *
> > >>>  *
> > >>>  */
> > >>> public abstract class MyEntityBean implements EntityBean {
> > >>>
> > >>>
> > >>> /**
> > >>>    * @ejb.interface-method
> > >>>    * @ejb.persistent-field
> > >>>    * @ejb.persistence
> > >>>    *     column-name= "name"
> > >>>    */
> > >>>    abstract public float getName();
> > >>>                 
> > >>> /**
> > >>>    *
> > >>>    *  @ejb.interface-method
> > >>>    *
> > >>>    * @struts.form-field form-name = "myBeanbForm"
> > >>>    *
> > >>>    * @struts.validator type="required" msgkey="name.required"
> > >>>    *
> > >>>    *
> > >>>    */
> > >>>    abstract public void setName(float changeValue);
> > >>> }
> > >>>
> > >>> 
> //////////////////////////////////////////////////////////////////
> > >>> //
> > >>> //
> > >>> //
> > >>> //
> > >>>
> > >>> when I do that, the form isn't added in struts-config.xml file 
> > >>> which
> > >>> is
> > >>> expected but the validation isn't included in the validation.xml
> > >>> either.. Suggestions anyone?
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> -------------------------------------------------------
> > >>> This SF.Net email is sponsored by BEA Weblogic Workshop 
> FREE Java 
> > >>> Enterprise J2EE developer tools! Get your free copy of BEA 
> > >>> WebLogic Workshop 8.1 today. 
> > >>> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> > >>> _______________________________________________
> > >>> xdoclet-user mailing list [EMAIL PROTECTED]
> > >>> https://lists.sourceforge.net/lists/listinfo/xdoclet-user
> > >>>
> > >>>
> > >>>
> > >>> -------------------------------------------------------
> > >>> This SF.Net email is sponsored by BEA Weblogic Workshop 
> FREE Java 
> > >>> Enterprise J2EE developer tools! Get your free copy of BEA 
> > >>> WebLogic Workshop 8.1 today. 
> > >>> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> > >>> _______________________________________________
> > >>> xdoclet-user mailing list [EMAIL PROTECTED]
> > >>> https://lists.sourceforge.net/lists/listinfo/xdoclet-user
> > >>
> > >>
> > >>
> > >> -------------------------------------------------------
> > >> This SF.Net email is sponsored by BEA Weblogic Workshop 
> FREE Java 
> > >> Enterprise J2EE developer tools! Get your free copy of 
> BEA WebLogic 
> > >> Workshop 8.1 today. 
> > >> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> > >> _______________________________________________
> > >> xdoclet-user mailing list [EMAIL PROTECTED]
> > >> https://lists.sourceforge.net/lists/listinfo/xdoclet-user
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java 
> > > Enterprise J2EE developer tools! Get your free copy of 
> BEA WebLogic 
> > > Workshop 8.1 today. 
> > > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> > > _______________________________________________
> > > xdoclet-user mailing list [EMAIL PROTECTED]
> > > https://lists.sourceforge.net/lists/listinfo/xdoclet-user
> > 
> > 
> > 
> > -------------------------------------------------------
> > This SF.Net email is sponsored by BEA Weblogic Workshop
> > FREE Java Enterprise J2EE developer tools!
> > Get your free copy of BEA WebLogic Workshop 8.1 today. 
> > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> > _______________________________________________
> > xdoclet-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/xdoclet-user
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today. 
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to