On Wed, 8 Jan 2003, Franco Caponi wrote:

> Date: Wed, 8 Jan 2003 18:06:06 +0100
> From: Franco Caponi <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: Re: DynaActionFormClass.getDynaActionFormClass
>
> Hi Craig,
> I have tha same problem: from an Action class i need to create the
> ActionForm associated with a particular mapping and populate some properties
> before returning the correct ActionForward, but i don't know how call the
> suggested RequestUtils.createActionForm().
>
> My problem is how to supply the ActionMapping parameter because i have found
> only the findActionConfig on the ModuleConfig that return a superclass of
> ActionMapping.
>
> Calling it with a cast to ActionMapping generate a NullPointerException...
>

You should get a ClassCastException if this were really an instance type
problem.  Without the stack trace, it's impossible to know what is really
happening.

> Can you supply a simple example/ How to??
>

Here's an additional technique that is a little more work, but just starts
with a ModuleConfig and a form bean name.

  ModuleConfig mconfig = ... ModuleConfig for the current module
  FormBeanConfig fbconfig = mconfig.findFormBeanConfig("foo");
  DynaActionFormClass dafc =
    new DynaActionFormClass(fbconfig);
  DynaActionForm daf = dafc.newInstance();

> TIA
>

Craig


> ----- Original Message -----
> From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> To: "Struts Developers List" <[EMAIL PROTECTED]>
> Sent: Monday, January 06, 2003 2:25 AM
> Subject: RE: DynaActionFormClass.getDynaActionFormClass
>
>
> >
> >
> > On Sun, 5 Jan 2003, Matt Raible wrote:
> >
> > > Date: Sun, 5 Jan 2003 17:12:51 -0700
> > > From: Matt Raible <[EMAIL PROTECTED]>
> > > Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> > > To: 'Struts Developers List' <[EMAIL PROTECTED]>
> > > Subject: RE: DynaActionFormClass.getDynaActionFormClass
> > >
> > > Has it become as easy as:
> > >
> > > DynaActionForm myForm = new DynaActionForm();
> > >
> > > ?? Man - that would be slick if (true)!
> > >
> >
> > Unfortunately, that is not technically feasible :-).
> >
> > Your best bet is the utility method RequestUtils.createActionForm().  As
> > an extra added advantage, this works for either standard ActionForm beans
> > or DynaActionForm beans.
> >
> > > Thanks,
> > >
> > > Matt
> >
> > Craig
> >
> >
> > --
> > 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