Re: DynaActionForm questions

2002-03-18 Thread Johan Compagner

The Bean en PropertyUtils should also be completely working with dynbean interface.
for example PropertyUtils.copyProperties(object,object) doesn't work right now

I see that they want to do something with PropertyDescriptors? I think that is a dead 
end.
Because property descripters are completely different they are really for get and set 
methods.

johan

- Original Message - 
From: Niall Pemberton [EMAIL PROTECTED]
To: Struts Developers List [EMAIL PROTECTED]
Sent: Sunday, March 17, 2002 4:37 AM
Subject: RE: DynaActionForm questions


 I haven't looked at DynaActionForm yet, but we are just starting to use
 DynaBeans - isn't the beauty of all this stuff that you don't have to use
 the provided DynaActionForm, but just go create your own version that suits
 your needs - sub-class ActionForm, implement the DynaBean interface and
 Bob's your uncle, it'll all work for you too - if its good and you think
 others would use it, submit it back to struts - I'm sure theres room for
 more than one implementation.
 
 Niall
 
  -Original Message-
  From: Bryan Field-Elliot [mailto:[EMAIL PROTECTED]]
  Sent: 15 March 2002 21:26
  To: Struts Developers List
  Subject: Re: DynaActionForm questions
 
 
  Thanks Craig,
 
  On Fri, 2002-03-15 at 14:19, Craig R. McClanahan wrote:
   Pretty slick, huh?  :-)
  
 
  It is slick indeed. The intended focus could just use a little more
  refining (perhaps in the users manual).
 
  If you know what your app needs to ask for, then DynaActionForms are a
  new and easier way to express it.
 
  On the other hand, if your application doesn't know what it's going to
  be asking for until runtime, then DynaActionForms aren't the complete
  solution, although they will probably be part of the solution I
  ultimately build.
 
  The two scenarios are pretty different, and the use of the dyna
  keyword could lead over-eager developers like me to assume something
  that isn't there.
 
  Thanks,
 
  Bryan
 
 
  --
  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]




Re: DynaActionForm questions

2002-03-18 Thread Craig R. McClanahan



On Mon, 18 Mar 2002, Johan Compagner wrote:

 Date: Mon, 18 Mar 2002 09:42:49 +0100
 From: Johan Compagner [EMAIL PROTECTED]
 Reply-To: Struts Developers List [EMAIL PROTECTED]
 To: Struts Developers List [EMAIL PROTECTED]
 Subject: Re: DynaActionForm questions

 The Bean en PropertyUtils should also be completely working with dynbean
 interface. for example PropertyUtils.copyProperties(object,object)
 doesn't work right now


It does for my test cases ... can you be more specific?  (Doing this on
COMMONS-DEV is probably better than here.)

 I see that they want to do something with PropertyDescriptors? I think
 that is a dead end. Because property descripters are completely
 different they are really for get and set methods.


I just checked in an enhancement to commons-beanutils that makes all of
the Converters, pluggable, and adds the ability to plug your own in.  This
will be much more efficient than using PropertyDescriptors for the typical
way that Struts programs do conversions.  (Default behavior is backwards
compatible, of course :-).

 johan


Craig


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




RE: DynaActionForm questions

2002-03-16 Thread Niall Pemberton

I haven't looked at DynaActionForm yet, but we are just starting to use
DynaBeans - isn't the beauty of all this stuff that you don't have to use
the provided DynaActionForm, but just go create your own version that suits
your needs - sub-class ActionForm, implement the DynaBean interface and
Bob's your uncle, it'll all work for you too - if its good and you think
others would use it, submit it back to struts - I'm sure theres room for
more than one implementation.

Niall

 -Original Message-
 From: Bryan Field-Elliot [mailto:[EMAIL PROTECTED]]
 Sent: 15 March 2002 21:26
 To: Struts Developers List
 Subject: Re: DynaActionForm questions


 Thanks Craig,

 On Fri, 2002-03-15 at 14:19, Craig R. McClanahan wrote:
  Pretty slick, huh?  :-)
 

 It is slick indeed. The intended focus could just use a little more
 refining (perhaps in the users manual).

 If you know what your app needs to ask for, then DynaActionForms are a
 new and easier way to express it.

 On the other hand, if your application doesn't know what it's going to
 be asking for until runtime, then DynaActionForms aren't the complete
 solution, although they will probably be part of the solution I
 ultimately build.

 The two scenarios are pretty different, and the use of the dyna
 keyword could lead over-eager developers like me to assume something
 that isn't there.

 Thanks,

 Bryan


 --
 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]




DynaActionForm questions

2002-03-15 Thread Bryan Field-Elliot

Hi,

I'm just today getting around to having a peek at the new
DynaActionForm. I'm slightly confused as to how useful this is, in a
setting in which you don't know at compile-time what fields you're going
to need to ask for.

Let's say for example I'm introspecting a JDBC table for a list of
columns and types, and want to dynamically build a form for CRUD
operations on this table. Or, instead of a JDBC table, maybe I want to
assemble a form out of an XML DTD or Schema.

I see that I can build an ActionForm class to hold values for this
table, out of DynaClasses (I'm basically already doing this in the
Simper project).

Where I'm missing something is, are there new Struts JSP tags for
building an HTML form out of a DynaActionForm? I don't see them, but
perhaps I'm missing the obvious.

If the answer is, There are no new JSP tags for building HTML forms out
of DynaActionForms, then I'm wondering just how useful DynaActionForm
is without it... What's a typical use case for it?

Thanks,

Bryan


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




Re: DynaActionForm questions

2002-03-15 Thread Craig R. McClanahan

Hi Bryan,

On 15 Mar 2002, Bryan Field-Elliot wrote:

 Date: 15 Mar 2002 13:33:05 -0700
 From: Bryan Field-Elliot [EMAIL PROTECTED]
 Reply-To: Struts Developers List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: DynaActionForm questions

 Hi,

 I'm just today getting around to having a peek at the new
 DynaActionForm. I'm slightly confused as to how useful this is, in a
 setting in which you don't know at compile-time what fields you're going
 to need to ask for.


Interesting that this has come up twice in the last week.

The current DynaActionForm implementation is indeed aimed at the case
where you know ahead of time which properties you need the bean to
represent, so that you can configure them in the struts-config.xml file.
The basic idea is to avoid the need to create custom ActionForm bean
classes for all the simple cases.

Right now, you would still need to create your own bean if you needed a
custom validate method, but even there we can look at adding declartive
ways to define simple validations (required fields, date formats, and so
on) so that even those don't require any custom Java code.

Since form beans are really part of the view tier in the Struts
implementation of MVC, one of the benefits of this will be that
responsibility for designing and configuring form beans can now be
migrated to the page designer that understands enough XML to code the
appropriate struts-config settings, instead of requiring a Java developer
to do this.  And, since creating form bean classes is pretty boring, the
Java developer gets to stay focused on the fun stuff.

 Let's say for example I'm introspecting a JDBC table for a list of
 columns and types, and want to dynamically build a form for CRUD
 operations on this table. Or, instead of a JDBC table, maybe I want to
 assemble a form out of an XML DTD or Schema.

DynaActionForm doesn't help you do either of these without custom Java
form bean classes.  Of course, neither did the original-style form beans
...

Doing this kind of form creation dynamically, though, is going to require
more than just DynaDynaActionForm classes.  You'll also need to figure
out how to decide what field prompts to create, what data types and
formats are valid, and other stuff like that.


 I see that I can build an ActionForm class to hold values for this
 table, out of DynaClasses (I'm basically already doing this in the
 Simper project).

 Where I'm missing something is, are there new Struts JSP tags for
 building an HTML form out of a DynaActionForm? I don't see them, but
 perhaps I'm missing the obvious.


You don't see them because they aren't needed :-)

 If the answer is, There are no new JSP tags for building HTML forms out
 of DynaActionForms, then I'm wondering just how useful DynaActionForm
 is without it... What's a typical use case for it?


The existing Struts tags work fine because they use BeanUtils and
PropertyUtils underneath.  These two classes have been made smart about
the bean object they are manipulating -- if you pass them a DynaBean, they
use the dynamic getters and setters.  Otherwise they use the Java
reflection mechanism as before.

So, you can even change your mind about whether a particular form bean is
a DynaActionForm, or a plain old-style form bean, without affecting your
pages at all -- just change the form-bean declaration and you are all
set.  Pretty slick, huh?  :-)

 Thanks,

 Bryan


Craig


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




RE: DynaActionForm questions

2002-03-15 Thread Heath Chiavettone

Hello all,

I'm looking for more information related to this thread.  I can see the
javadoc for the class, but I can't seem to find any real documentation on
how to configure things in the struts-config.xml file.  If someone can point
me to where this information is, I'd appreciate it.

TIA,
Heath

-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 15, 2002 1:20 PM
To: Struts Developers List
Subject: Re: DynaActionForm questions

Hi Bryan,

On 15 Mar 2002, Bryan Field-Elliot wrote:

 Date: 15 Mar 2002 13:33:05 -0700
 From: Bryan Field-Elliot [EMAIL PROTECTED]
 Reply-To: Struts Developers List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: DynaActionForm questions

 Hi,

 I'm just today getting around to having a peek at the new
 DynaActionForm. I'm slightly confused as to how useful this is, in a
 setting in which you don't know at compile-time what fields you're going
 to need to ask for.


Interesting that this has come up twice in the last week.

The current DynaActionForm implementation is indeed aimed at the case
where you know ahead of time which properties you need the bean to
represent, so that you can configure them in the struts-config.xml file.
The basic idea is to avoid the need to create custom ActionForm bean
classes for all the simple cases.

Right now, you would still need to create your own bean if you needed a
custom validate method, but even there we can look at adding declartive
ways to define simple validations (required fields, date formats, and so
on) so that even those don't require any custom Java code.

Since form beans are really part of the view tier in the Struts
implementation of MVC, one of the benefits of this will be that
responsibility for designing and configuring form beans can now be
migrated to the page designer that understands enough XML to code the
appropriate struts-config settings, instead of requiring a Java developer
to do this.  And, since creating form bean classes is pretty boring, the
Java developer gets to stay focused on the fun stuff.

 Let's say for example I'm introspecting a JDBC table for a list of
 columns and types, and want to dynamically build a form for CRUD
 operations on this table. Or, instead of a JDBC table, maybe I want to
 assemble a form out of an XML DTD or Schema.

DynaActionForm doesn't help you do either of these without custom Java
form bean classes.  Of course, neither did the original-style form beans
...

Doing this kind of form creation dynamically, though, is going to require
more than just DynaDynaActionForm classes.  You'll also need to figure
out how to decide what field prompts to create, what data types and
formats are valid, and other stuff like that.


 I see that I can build an ActionForm class to hold values for this
 table, out of DynaClasses (I'm basically already doing this in the
 Simper project).

 Where I'm missing something is, are there new Struts JSP tags for
 building an HTML form out of a DynaActionForm? I don't see them, but
 perhaps I'm missing the obvious.


You don't see them because they aren't needed :-)

 If the answer is, There are no new JSP tags for building HTML forms out
 of DynaActionForms, then I'm wondering just how useful DynaActionForm
 is without it... What's a typical use case for it?


The existing Struts tags work fine because they use BeanUtils and
PropertyUtils underneath.  These two classes have been made smart about
the bean object they are manipulating -- if you pass them a DynaBean, they
use the dynamic getters and setters.  Otherwise they use the Java
reflection mechanism as before.

So, you can even change your mind about whether a particular form bean is
a DynaActionForm, or a plain old-style form bean, without affecting your
pages at all -- just change the form-bean declaration and you are all
set.  Pretty slick, huh?  :-)

 Thanks,

 Bryan


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]




RE: DynaActionForm questions

2002-03-15 Thread Craig R. McClanahan



On Fri, 15 Mar 2002, Heath Chiavettone wrote:

 Date: Fri, 15 Mar 2002 15:56:42 -0800
 From: Heath Chiavettone [EMAIL PROTECTED]
 Reply-To: Struts Developers List [EMAIL PROTECTED]
 To: 'Struts Developers List' [EMAIL PROTECTED]
 Subject: RE: DynaActionForm questions

 Hello all,

 I'm looking for more information related to this thread.  I can see the
 javadoc for the class, but I can't seem to find any real documentation on
 how to configure things in the struts-config.xml file.  If someone can point
 me to where this information is, I'd appreciate it.


It's not heavily covered in the docs yet.  The places I would look first:

* The lib/struts-config_1_1.dtd file (the DTD for struts-config.xml
  files) documents the new attributes of the form-bean and nested
  form-property elements).

* The struts-config.xml for the Struts example app uses a dynamic form
  bean for the login form, configured like this:

form-bean name=logonForm
   type=org.apache.struts.action.DynaActionForm
  form-property name=username type=java.lang.String/
  form-property name=password type=java.lang.String/
/form-bean

Both of these are available in the recent nightly builds (which run from
the HEAD branch).

You might also download the commons-beanutils package (and associated
docs) from the Jakarta web site.  The Javadocs cover some of the general
concepts of programming DynaBeans:

  http://jakarta.apache.org/builds/jakarta-commons/nightly/commons-beanutils/

While you're there, Struts 1.1 will use several other Commons packages as
enhanced features or as replacements for code from org.apache.struts.util
- you might want to grab the packages for the collections, dbcp, digester,
pool, services, and validator packages as well.

 TIA,
 Heath


Craig


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