Given the length of this thread and the effort people seem to be putting into 
instantiating their own forms, especialy Dyna*Form objects, I was wondering 
why people are doing this themselves rather than just letter ActionServlet 
(RequestProcessor) do it  when you have specified 
the form-bean name in the struts-config.xml mapping for that Action.

Is there some advantage to instantiating the form yourself, or is this just 
being done in special cases where people specifically do not want the form to 
be instantiated or they are dynamically creating ActionForm objects which are 
not defined in struts-config.xml, etc. etc.     Just wondering if I am 
missing something here.

- Charlie


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

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

Reply via email to