You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ashish Kulkarni <ku...@yahoo.com> on 2002/08/22 22:52:25 UTC

ActionForm and DynaActionForm

Hi,

How to decide about using ActionForm and DynaActionForm ??

 

 


A$HI$H


---------------------------------
Do You Yahoo!?
HotJobs, a Yahoo! service - Search Thousands of New Jobs

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>


DynaActionForm - docs somewhere? Bean Creating Exception?

Posted by Fabian Sommer <fa...@web.de>.
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>


Cannot retrieve mapping for action /loginForm error

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi,

I am getting this error, please find the mappings from struts-cong below

<form-bean name="loginForm" 

dynamic="true"

type="org.apache.struts.validator.DynaValidatorForm">

<form-property name="system" type="java.lang.String"/>

<form-property name="userId" type="java.lang.String"/>

<form-property name="password" type="java.lang.String"/>

</form-bean>

<action path="/login" type="com.pfizer.maps.LoginAction" name="loginForm" scope="request" validate="true" input="index.jsp">

<forward name="error" path="/index.jsp"/>

<forward name="success" path="/index.jsp"/>

</action>

 

and i have class com.pfizer.maps.LoginAction in web-inf/classes/com/pfizer/maps

so what wrong i am doing , please help ASAP

javax.servlet.jsp.JspException: Cannot retrieve mapping for action /loginForm
	at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:871)


Ashish

 


A$HI$H


---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

Re: ActionForm and DynaActionForm

Posted by "Craig R. McClanahan" <cr...@apache.org>.

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
>
> >
> > At 04:52 am 23-08-2002, you wrote:
> > >Hi,
> > >
> > >How to decide about using ActionForm and DynaActionForm ??
> > >
> > >A$HI$H
> >
> > --
> > John Yu Scioworks Technologies
> > e: john@scioworks.com w: +(65) 873 5989
> > w: http://www.scioworks.com m: +(65) 9782 9610
> >
> > Scioworks Camino - "Don't develop Struts Apps without it!"
> >
> >
> > --
> > To unsubscribe, e-mail:
> > For additional commands, e-mail:
> >
> >
>
>
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail:
>
>
> A$HI$H
>
>
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes


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


Error while Retrieving FormFile From Map

Posted by "Sudhir S. Shetty" <ss...@powershare.net>.
Hi,
     I have a Jsp page in which I upload a file using the <html:file
property="prtFormFileAttachment"/> tag,
In my action class I use BeanUtils to get a Map of my form Bean in which I
have a FormFile As an attribute.
I pass this Map to my Bussiness Object,
In the Bussiness object when I issue the command
FormFile pvtFormFile = (FormFile)pvtMapForm.get("prtFormFileAttachment");
I get an Exception
java.lang.ClassCastException: java.lang.String
	at com.inveniotech.docmgt.DmDocMgtBaseBo.insertAttachedModel(DmDocMgtBaseBo

Kindly guide mne as to how can i get the  file from the Map
TIA,
regards,
Sudhir



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


Struts and Differnet date Validation

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi,

I have to validate the date entered by the user, but in my case the valid date may be dd/mm/yyyy or mm/dd/yyyy, or yyyy/mm/dd

depending on the a parameter which i will be storing in user session, 

so how can i do it???

Ashish


A$HI$H


---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

Re: ActionForm and DynaActionForm

Posted by Ashish Kulkarni <ku...@yahoo.com>.
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???
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
 
 "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

>
> At 04:52 am 23-08-2002, you wrote:
> >Hi,
> >
> >How to decide about using ActionForm and DynaActionForm ??
> >
> >A$HI$H
>
> --
> John Yu Scioworks Technologies
> e: john@scioworks.com w: +(65) 873 5989
> w: http://www.scioworks.com m: +(65) 9782 9610
>
> Scioworks Camino - "Don't develop Struts Apps without it!"
>
>
> --
> To unsubscribe, e-mail: 
> For additional commands, e-mail: 
>
>


--
To unsubscribe, e-mail: 
For additional commands, e-mail: 


A$HI$H


---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

Re: ActionForm and DynaActionForm

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 23 Aug 2002, John Yu wrote:

> Date: Fri, 23 Aug 2002 09:51:57 +0800
> From: John Yu <jo...@scioworks.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
>
> 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 <form-property> elements
> inside the <form-bean> 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

>
> At 04:52 am 23-08-2002, you wrote:
> >Hi,
> >
> >How to decide about using ActionForm and DynaActionForm ??
> >
> >A$HI$H
>
> --
> John Yu                       Scioworks Technologies
> e: john@scioworks.com         w: +(65) 873 5989
> w: http://www.scioworks.com  m: +(65) 9782 9610
>
> Scioworks Camino - "Don't develop Struts Apps without it!"
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


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


Re: ActionForm and DynaActionForm

Posted by John Yu <jo...@scioworks.com>.
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 <form-property> elements 
inside the <form-bean> config element and specify 'dynamic="true"'.


At 04:52 am 23-08-2002, you wrote:
>Hi,
>
>How to decide about using ActionForm and DynaActionForm ??
>
>A$HI$H

-- 
John Yu                       Scioworks Technologies
e: john@scioworks.com         w: +(65) 873 5989
w: http://www.scioworks.com  m: +(65) 9782 9610

Scioworks Camino - "Don't develop Struts Apps without it!"


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