On Wed, 10 Jul 2002, James Mitchell wrote:

> Date: Wed, 10 Jul 2002 16:54:49 -0400
> From: James Mitchell <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>,
>      [EMAIL PROTECTED]
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: RE: DO NOT REPLY [Bug 7751]  -     DynaValidatorForm
>     throwsNullPointerException and ClassCastException
>
> This is great Craig, I can't believe it wasn't thought of earlier.
>
> One quick question...(I'll probably try it later tonight anyway)...but:
>
> does this mean I can do this...
>
>     <form-bean      name="logonForm"
>                     type="com.myform.that.extends.ActionForm">
>       <form-property name="username" type="java.lang.String"/>
> <!--      <form-property name="password" type="java.lang.String"/> -->
>     </form-bean>
>
> ...and have only password/getPassword()/setPassword() defined???
>
> Or is it an 'all or nothing' approach?
>

I'm not sure I know quite what you mean by 'all or nothing', but a form
bean has to be either DynaActionForm (or a subclass), in which case it's a
DynaBean with the properties identified by <form-property> elements, or
it's an ActionForm (or subclass), in which case any <form-property>
settings are ignored.  All I changed is that the "dynamic" attribute is
calculated from the implementation class, based on whether it's a DAF or
not.

You can't mix standard JavaBean properties and DynaBean properties in the
same bean -- the commons-beanutils classes always do (bean instanceof
DynaBean) checks when deciding what to do.

>
>
> James Mitchell
> Software Engineer\Struts Evangelist
> Struts-Atlanta, the "Open Minded Developer Network"
> http://www.open-tools.org/struts-atlanta
>

Craig


>
>
>
> > -----Original Message-----
> > From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, July 10, 2002 4:38 PM
> > To: Struts Developers List
> > Subject: Re: DO NOT REPLY [Bug 7751] - DynaValidatorForm
> > throwsNullPointerException and ClassCastException
> >
> >
> > <shame-faced>
> > OK, OK, I just committed a fix based on this to eliminate having to set
> > the stupid "dynamic" attribute for DynaActionForm subclasses.  It shoulda
> > never been there in the first place.
> > </shame-faced>
> >
> > Craig
> >
> >
> >
> > On 10 Jul 2002 [EMAIL PROTECTED] wrote:
> >
> > > Date: 10 Jul 2002 18:38:39 -0000
> > > From: [EMAIL PROTECTED]
> > > Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> > > To: [EMAIL PROTECTED]
> > > Subject: DO NOT REPLY [Bug 7751]  -     DynaValidatorForm throws
> > >     NullPointerException and ClassCastException
> > >
> > > DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
> > > RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
> > > <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7751>.
> > > ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
> > > INSERTED IN THE BUG DATABASE.
> > >
> > > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7751
> > >
> > > DynaValidatorForm throws NullPointerException and ClassCastException
> > >
> > > [EMAIL PROTECTED] changed:
> > >
> > >            What    |Removed                     |Added
> > >
> > ------------------------------------------------------------------
> > ----------
> > >              Status|NEW                         |RESOLVED
> > >          Resolution|                            |FIXED
> > >
> > >
> > >
> > > ------- Additional Comments From [EMAIL PROTECTED]  2002-07-10
> > 18:38 -------
> > > I have had the same problem, and Joe has right the
> > dynamic="true" attribute on
> > > the form-bean element solves the issue. But I think it's a
> > better solution if
> > > change some lines in the FormBeanConfig:
> > >
> > > Index: FormBeanConfig.java
> > > ===================================================================
> > > RCS file: /home/cvspublic/jakarta-
> > > struts/src/share/org/apache/struts/config/FormBeanConfig.java,v
> > > retrieving revision 1.6
> > > diff -u -r1.6 FormBeanConfig.java
> > > --- FormBeanConfig.java 9 Jul 2002 23:57:37 -0000       1.6
> > > +++ FormBeanConfig.java 10 Jul 2002 18:34:57 -0000
> > > @@ -152,8 +152,14 @@
> > >              throw new IllegalStateException("Configuration is frozen");
> > >          }
> > >          this.type = type;
> > > -        if ("org.apache.struts.action.DynaActionForm".equals(type)) {
> > > -            this.dynamic = true;
> > > +        try {
> > > +            Class formClazz = Class.forName(type);
> > > +            Class dynaClazz = Class.forName
> > > ("org.apache.struts.action.DynaActionForm");
> > > +            if (dynaClazz.isAssignableFrom(formClazz)) {
> > > +                this.dynamic = true;
> > > +            }
> > > +        } catch (Exception e) {
> > > +            throw new IllegalArgumentException("Form type
> > can't be found");
> > >          }
> > >      }
> > >
> > > --
> > > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> >
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


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

Reply via email to