You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Steve Lewis <sm...@lordjoe.com> on 2004/04/30 17:24:07 UTC
Can I specify DynaFormProperties at Run Time
Given that the Dynaform is dynamic I am wondering why I need to declare a
dynaform and list its properties in struts-config. I would prefer to have
my action populate a form adding properties that it knows without having to
declare the form in struts-config.
1) Is this possible
2) If so how do you do that?
3) Is anyone doing this?
Steven M. Lewis PhD
4221 105th Ave NE
Kirkland, WA 98033
425-889-2694
206-384-1340 (cell)
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Can I specify DynaFormProperties at Run Time
Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
I developed LazyDynaBean and LazyDynaClass (which implements
MutableDynaClass) which don't need their properties to be pre-defined.
I have also used them to create LazyValidatorForm which is a version of
DynaValidatorForm backed by a LazyDynaBean.
All thats needed in the struts-config.xml is:
<form-beans>
<form-bean name="myForm"
type="lib.framework.struts.LazyValidatorActionForm"/>
</form-beans>
Source Code is here: http://www.niallp.pwp.blueyonder.co.uk
Niall
----- Original Message -----
From: "Joe Germuska" <Jo...@Germuska.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Friday, April 30, 2004 6:54 PM
Subject: Re: Can I specify DynaFormProperties at Run Time
> At 8:24 AM -0700 4/30/04, Steve Lewis wrote:
> >Given that the Dynaform is dynamic I am wondering why I need to
> >declare a dynaform and list its properties in struts-config. I would
> >prefer to have my action populate a form adding properties that it
> >knows without having to declare the form in struts-config.
> >1) Is this possible
> >2) If so how do you do that?
> >3) Is anyone doing this?
>
> It's difficult to do because of the process by which dynabeans are
> defined and managed. One of my colleagues worked on a project where,
> in one case, form fields were defined by database data. We
> implemented this with a PlugIn which, at initialization time,
> registered its own dynaforms using the static
> DynaActionFormClass.createDynaActionFormClass() method. Even this,
> then, isn't truly dynamic, but that's part of how DynaActionFormClass
> is designed.
>
> I think that we should steer Struts to having one or more ActionForm
> factories which can produce forms in more flexible ways. I don't
> have any specific design ideas in mind, but I've seen how annoying it
> is to get instances of DynaForms (for example, if you want to prefill
> a form), as well as the use case we're discussing right now.
>
> As always, I encourage interested Struts users to grab the source
> code and wrap their heads around how Struts works, possibly coming up
> with specific suggestions on how things can be improved (and perhaps
> even patches!) -- the more minds the better...
>
> A simpler solution might be to simply declare a DynaActionForm which
> has a single mapped property. You could probably get a good bit of
> what you need there with less investment.
>
> Joe
>
> --
> Joe Germuska
> Joe@Germuska.com
> http://blog.germuska.com
> "Imagine if every Thursday your shoes exploded if you tied them
> the usual way. This happens to us all the time with computers, and
> nobody thinks of complaining."
> -- Jef Raskin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Can I specify DynaFormProperties at Run Time
Posted by Joe Germuska <Jo...@Germuska.com>.
At 8:24 AM -0700 4/30/04, Steve Lewis wrote:
>Given that the Dynaform is dynamic I am wondering why I need to
>declare a dynaform and list its properties in struts-config. I would
>prefer to have my action populate a form adding properties that it
>knows without having to declare the form in struts-config.
>1) Is this possible
>2) If so how do you do that?
>3) Is anyone doing this?
It's difficult to do because of the process by which dynabeans are
defined and managed. One of my colleagues worked on a project where,
in one case, form fields were defined by database data. We
implemented this with a PlugIn which, at initialization time,
registered its own dynaforms using the static
DynaActionFormClass.createDynaActionFormClass() method. Even this,
then, isn't truly dynamic, but that's part of how DynaActionFormClass
is designed.
I think that we should steer Struts to having one or more ActionForm
factories which can produce forms in more flexible ways. I don't
have any specific design ideas in mind, but I've seen how annoying it
is to get instances of DynaForms (for example, if you want to prefill
a form), as well as the use case we're discussing right now.
As always, I encourage interested Struts users to grab the source
code and wrap their heads around how Struts works, possibly coming up
with specific suggestions on how things can be improved (and perhaps
even patches!) -- the more minds the better...
A simpler solution might be to simply declare a DynaActionForm which
has a single mapped property. You could probably get a good bit of
what you need there with less investment.
Joe
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"Imagine if every Thursday your shoes exploded if you tied them
the usual way. This happens to us all the time with computers, and
nobody thinks of complaining."
-- Jef Raskin
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Can I specify DynaFormProperties at Run Time
Posted by Marco Mistroni <mm...@waersystems.com>.
Hi,
I missed some mails coz I was away....
Did anyone replied to this question?
I guess there was one guy (Hubert Rabago if I m correct)
That has done something similar........
Regards
marco
-----Original Message-----
From: Steve Lewis [mailto:smlewis@lordjoe.com]
Sent: 30 April 2004 16:24
To: struts-user@jakarta.apache.org
Subject: Can I specify DynaFormProperties at Run Time
Given that the Dynaform is dynamic I am wondering why I need to declare
a
dynaform and list its properties in struts-config. I would prefer to
have
my action populate a form adding properties that it knows without having
to
declare the form in struts-config.
1) Is this possible
2) If so how do you do that?
3) Is anyone doing this?
Steven M. Lewis PhD
4221 105th Ave NE
Kirkland, WA 98033
425-889-2694
206-384-1340 (cell)
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org