You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Will Hartung <wi...@msoft.com> on 2006/03/25 02:53:56 UTC

Dynamic DynaActionForms

Simply put I have a need for a configurable form that can have any mixture
of fields on it including, specifically, file uploads.

Seems to me that the DynaActionForm would be the way to go about this,
however, they're defined in struts-config.

Clearly, struts already has all of the code to convert an HTML request in to
a DynaActionForm, so I'd rather not reinvent that wheel if possible.

Now it seems to me that I should be able to simply instantiate my own
DynaActionForm that has all of the properties that coincedently looks like
the form that's being submitted.

Has anyone done something like this?

I've been playing with trying to instatiate an DynaActionForm using some
"hand made" FormPropertyConfig's, and then calling
DynaFormAction.initialize(FormConfigBean), but I'm getting some null pointer
exceptions, so I'm obviously missing something.

I'd also like to intercept the form creation process to make the
DynaActionForm on the fly during the request pipeline and, ideally, stuff
the form in the Request scope where it belongs. Right now I have to stuff it
in to the Session using an Action before the page is displayed, but
obviously this won't work if there is the potential for more than one form
to exist.

So, anyway, has anyone tried to leverage the Struts pipeline to create "on
the fly" DynaActionForms so you could leverage all of the built in Struts
facilities? Has anyone ever successfully created a DynaActionForm directly
rather than using the struts-config file?

Thanx!

Regards,

Will Hartung
(willh@msoft.com)




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Dynamic DynaActionForms

Posted by Hubert Rabago <hr...@gmail.com>.
Maybe you can leverage the LazyActionForm:

http://struts.apache.org/struts-action/userGuide/building_controller.html#lazy_action_form_classes

Hubert

On 3/24/06, Will Hartung <wi...@msoft.com> wrote:
> Simply put I have a need for a configurable form that can have any mixture
> of fields on it including, specifically, file uploads.
>
> Seems to me that the DynaActionForm would be the way to go about this,
> however, they're defined in struts-config.
>
> Clearly, struts already has all of the code to convert an HTML request in to
> a DynaActionForm, so I'd rather not reinvent that wheel if possible.
>
> Now it seems to me that I should be able to simply instantiate my own
> DynaActionForm that has all of the properties that coincedently looks like
> the form that's being submitted.
>
> Has anyone done something like this?
>
> I've been playing with trying to instatiate an DynaActionForm using some
> "hand made" FormPropertyConfig's, and then calling
> DynaFormAction.initialize(FormConfigBean), but I'm getting some null pointer
> exceptions, so I'm obviously missing something.
>
> I'd also like to intercept the form creation process to make the
> DynaActionForm on the fly during the request pipeline and, ideally, stuff
> the form in the Request scope where it belongs. Right now I have to stuff it
> in to the Session using an Action before the page is displayed, but
> obviously this won't work if there is the potential for more than one form
> to exist.
>
> So, anyway, has anyone tried to leverage the Struts pipeline to create "on
> the fly" DynaActionForms so you could leverage all of the built in Struts
> facilities? Has anyone ever successfully created a DynaActionForm directly
> rather than using the struts-config file?
>
> Thanx!
>
> Regards,
>
> Will Hartung
> (willh@msoft.com)
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org