interesting idea, but i dont think beanUtils is driving the whole dynaforms thing. I think its just a big HashMap they stick stuff into (for the moment). The big problem is that DynaForms requires you to specify the initial values in the <form-property> as that "initial" value. So, with complex value objects and Collections, its not smart enough (yet) to instantiate even an empty object. It only knows how to create Wrapper classes with values in them.
That's why i started toying with the direct DynaActionForm.set() in the action class. As far as i explored, that was the only way to get around this. And if you are using the XML validation in conjuction, it gets even messier my friend. dz -----Original Message----- From: Andy Kriger [mailto:akriger@;greaterthanone.com] Sent: Thursday, November 14, 2002 11:19 AM To: Struts Users Mailing List Subject: RE: help needed with DynaActionForm I'm speaking at the edge of understanding here, but... If BeanUtils is underlying this whole thing, then you should be able to create the user-objects instead of defaulting them to null (using the JavaBean no-arg ctor). And following on that you could use the property referencing struture used by the rest of Struts (e.g. object.field or object[0].object.field) to handle the validation. At first at least, one could implement this by handling user-objects but requiring that the last value in the property referencing be a primitive or Strings (for validation and returning objects to the form). Then I guess it could be expanded to user-objects using a Validatable interface (similar to the Comparable interface used by Arrays.sort). -----Original Message----- From: Drew Zimber [mailto:drew.zimber@;shaws.com] Sent: Thursday, November 14, 2002 11:00 To: 'Andy Kriger'; 'Struts Users Mailing List' Subject: RE: help needed with DynaActionForm "...I'm guessing it wouldn't be that hard to extend the form to handle any old Object, maybe someone more in the know with the src can comment on this?" actually, i found some documentation about this on the web. You can subclass DynaActionForm and add your own attributes, but it sort of defeats the purpose of having a DynaForm. You'll sort of have a "half and half" form and im not sure how i feel about that. for the DynaForms, you can put ANY object into the form, because it stores all objects in a HashMap. However, when you get to validation and returning objects to the form on submit, it gets messy. The DynaForms still need some time to mature... dz -----Original Message----- From: Andy Kriger [mailto:akriger@;greaterthanone.com] Sent: Thursday, November 14, 2002 10:45 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: help needed with DynaActionForm Currently the first action in my webapp is an ForwardAction that takes you to the JSP. So, if I understand you right, I could make this work by replacing that with an Initalization action that creates the objects for use in the form. I'll try that and report back. I'm guessing it wouldn't be that hard to extend the form to handle any old Object, maybe someone more in the know with the src can comment on this? thx andy -----Original Message----- From: Drew Zimber [mailto:drew.zimber@;shaws.com] Sent: Thursday, November 14, 2002 10:35 To: 'Struts Users Mailing List' Subject: RE: help needed with DynaActionForm from: http://jakarta.apache.org/struts/userGuide/building_controller.html#dyna_act ion_form_classes "The list of types supported by DynaActionForm beans includes: java.lang.BigDecimal java.lang.BigInteger boolean and java.lang.Boolean byte and java.lang.Byte char and java.lang.Character java.lang.Class double and java.lang.Double float and java.lang.Float int and java.lang.Integer long and java.lang.Long short and java.lang.Short java.lang.String java.sql.Date java.sql.Time java.sql.Timestamp " now, with that being said. I have used my own classes in the DynaForms, but they wil lbe initialized to null UNLESS you do the following: 1) in the Action class, cast the form to a DynaActionForm 2) do an explicit myForm.set("myProperty", new myObject()) type call all in all, i did alot of research on dynaforms and they are pretty useful, but in my opinion they arent versatile enough yet for complex applications/valdation...In the end we choose to retain mostly traditional forms. drew -----Original Message----- From: Andy Kriger [mailto:akriger@;greaterthanone.com] Sent: Thursday, November 14, 2002 10:25 AM To: Struts Users Mailing List Subject: help needed with DynaActionForm I am trying to set properties of an object using DynaActionForm. In my struts-config.xml I have in the <form-bean> <form-property name='creditCard' type='my.package.CreditCard' /> In my JSP I try <html:text property='creditCard.type' /> The CreditCard class has a no-arg ctor and get/set methods for all of its fields. When I load the JSP I get an error Null property value for 'creditCard' I'm guessing that DynaActionForm is not initializing the CreditCard object, but I don't know why (I thought that was the point of DynaActionForm - to be able to use any object and initialize it from the form automatically). Can anyone who has done this successfully point me in the right direction? thx andy -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>