You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Fabian Sommer <fa...@web.de> on 2002/08/26 13:18:42 UTC

DynaActionForm - docs somewhere? Bean Creating Exception?

Hello!
I try to use DynaActionForms for the first time. I tried to do it the
way explained below, but all I get from Tomcat is this errormessage:
Exception creating bean of class null: {1}
Does anybody know the meaning of this errormessage?
Are there some docs on the use of DynaActionForms somewhere out there?
They seem to miss within actual struts docu...
Thx, Fabian

> -----Original Message-----
> From: Craig R. McClanahan [mailto:craigmcc@apache.org]
> Sent: Friday, August 23, 2002 5:56 PM
> To: Struts Users Mailing List
> Subject: Re: ActionForm and DynaActionForm
> 
> 
> 
> On Fri, 23 Aug 2002, Ashish Kulkarni wrote:
> 
> > Date: Fri, 23 Aug 2002 07:48:12 -0700 (PDT)
> > From: Ashish Kulkarni <ku...@yahoo.com>
> > Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> > To: Struts Users Mailing List <st...@jakarta.apache.org>
> > Subject: Re: ActionForm and DynaActionForm
> >
> >
> > Hi,
> 
> > So does this mean that if i am using DynaActionForm i dont need to
> > define any action form .i.e. a class which extends ActionForm and
has
> > all the get and set methods for input fields???
> 
> If you don't need custom reset() or validate() methods, that is
correct --
> you do not need to create an ActionForm class of your own.
> 
> If you do need custom reset() or validate() methods, then you can
still
> subclass DynaActionForm, but you only have to implement those two
methods.
> 
> > so in this case how can
> > i access these fields on in my Action class, normally in my
ActionClass
> > i will get the values set in the fields from ActionForm class like
> > testform data = (testform) form; where testform is the class which
> > extends ActionForm and has get and set method, so in DynaActionForm
if i
> > dont have to define ActionForm, how can i get the values in Action
class
> 
> > Ashish
> >
> 
> DynaActionForm is an implementation of the DynaBean interface from
> commons-beanutils -- see online JavaDocs at
> <http://jakarta.apache.org/commons/beanutils/api>.  So, if you've
declared
> your form bean like this:
> 
>   <form-bean name="logonForm" ...>
>     <form-property name="username" type="java.lang.String"/>
>     <form-property name="password" type="java.lang.String"/>
>   </form-bean>
> 
> then, in your LogonAction, you can access the properties like this:
> 
>   DynaActionForm daf = (DynaActionForm) form; // Save casting every
time
>   String username = (String) daf.get("username");
>   String password = (String) daf.get("password"));
> 
> There are also get() methods for accessing indexed and mapped
properties,
> as well as set() methods to update all these things.
> 
> You can also use PropertyUtils and BeanUtils to access properties in a
> DynaBean, because they call the get() and set() methods for you
> transparently on a DynaBean.
> 
> Craig
> 
> 
> >  "Craig R. McClanahan" wrote:
> >
> > On Fri, 23 Aug 2002, John Yu wrote:
> >
> > > Date: Fri, 23 Aug 2002 09:51:57 +0800
> > > From: John Yu
> > > Reply-To: Struts Users Mailing List
> > > To: Struts Users Mailing List
> > > Subject: Re: ActionForm and DynaActionForm
> > >
> > > Use ActionForm if you inherit your own JavaBean-compliant
FormBeans.
> > >
> > > Use DynaActionForm if you don't want to code the tedious
getter/setter
> > > methods but rely on the DynaActionForm's dynamic properties (think
> > > name-value pairs, something like HashMap). (Note: DynaActionForm
is
> > > *psuedo* JavaBean-compliant. It behaves as if it's a JavaBean with
the
> > > BeanUtils library.)
> > >
> > > To use DynaActionForm, you need to specify the elements
> > > inside the config element and specify 'dynamic="true"'.
> > >
> >
> > Note that dynamic="true" is no longer required in 1.1-b2. It was a
hack
> > to get around some developer laziness at the time this code was
> initially
> > created :-).
> >
> > Craig
> >


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: DynaActionForm - docs somewhere? Bean Creating Exception?

Posted by Fabian Sommer <fa...@web.de>.
> > > Exception creating bean of class null: {1}
> > > Does anybody know the meaning of this errormessage?
> > > Are there some docs on the use of DynaActionForms somewhere out
> there?
> > > They seem to miss within actual struts docu...
> > > Thx, Fabian
> >
> > You can download and read Chuck's preview:
> > http://www.theserverside.com/resources/strutsreview.jsp
> >
Got it myself now:
I have to add the DynaActionForm-class for the bean - I should have
gotten this earlier... ;)

<form-bean name="wauswahl"
	type="org.apache.struts.action.DynaActionForm">
	<form-property name="wid" type="java.lang.String"/>
</form-bean>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: DynaActionForm - docs somewhere? Bean Creating Exception?

Posted by Fabian Sommer <fa...@web.de>.
Whoever you are - could you please point me to the chapter where I find
help in understanding DynaActionForms? And are there any error-codes
explained?
Thx, Fabian

> -----Original Message-----
> From: mailinglist [mailto:mlst@mangoosta.fr]
> Sent: Monday, August 26, 2002 1:50 PM
> To: Struts Users Mailing List
> Subject: Re: DynaActionForm - docs somewhere? Bean Creating Exception?
> 
> 
> 
> > Hello!
> > I try to use DynaActionForms for the first time. I tried to do it
the
> > way explained below, but all I get from Tomcat is this errormessage:
> > Exception creating bean of class null: {1}
> > Does anybody know the meaning of this errormessage?
> > Are there some docs on the use of DynaActionForms somewhere out
there?
> > They seem to miss within actual struts docu...
> > Thx, Fabian
> 
> You can download and read Chuck's preview:
> http://www.theserverside.com/resources/strutsreview.jsp
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-
> help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DynaActionForm - docs somewhere? Bean Creating Exception?

Posted by mailinglist <ml...@mangoosta.fr>.

> Hello!
> I try to use DynaActionForms for the first time. I tried to do it the
> way explained below, but all I get from Tomcat is this errormessage:
> Exception creating bean of class null: {1}
> Does anybody know the meaning of this errormessage?
> Are there some docs on the use of DynaActionForms somewhere out there?
> They seem to miss within actual struts docu...
> Thx, Fabian

You can download and read Chuck's preview:
http://www.theserverside.com/resources/strutsreview.jsp


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>