On Fri, 31 Jan 2003, Wendy Smoak wrote:

> Date: Fri, 31 Jan 2003 11:14:25 -0700
> From: Wendy Smoak <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> Subject: RE: Question about  struts-example struts-config.xml
>
> Craig wrote:
> > For this specific case, there is no reason to have a LogonForm class at
> > all, because the default behavior of a DynaValidatorForm (which is a
> > DynaActionForm plus using the validator framework to define validation
> > rules) does everything you need.
>
> Wow... I just deleted the LogonForm.class file under the 'classes' directory
> and reloaded the app... and everything still worked.  Then I added a field
> to the form in struts-config.xml, and to logon.jsp, reloaded again, and my
> new field magically appeared.  NOW I see how it works!
>
> > The only reason you would ever need to create a real class that extends
> > DynaActionForm or DynaValidatorForm would be if you need a custom reset()
> > or validate() method.
>
> Confused again.  (I will need a custom validate method.)  How does Struts
> know to start with my class that extends DynaWhateverForm and add the stuff
> in the <form-bean> tag to it, rather than creating a new one?  Would it be:
>     <form-bean      name="logonForm"
>                     type="edu.asu.vpia.blah.blah.LogonForm">
>
> and then
>   package edu.asu.vpia.blah.blah;
>   public final class LogonForm extends DynaValidatorForm { ... }
>
> ??
>

Yep ... that's how.  Struts will use introspection to tell whether your
form bean class is a DynaBean or not -- specifically, look at the
setType() method of org.apache.struts.config.FormBeanConfig to make the
determination whether your bean is dynamic or not.

> Thanks for helping me through this part!
>
> --
> Wendy Smoak
> Applications Systems Analyst, Sr.
> Arizona State University PA Information Resources Management
>

Craig


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to