Patrick,

I have written my own converters for converting from String to Date , Long
to Date etc. So i think something like that can be done with your bean
too....my only concern is , i havent tried things like :      <form-property
         name="fileDisplay"
         type="org.apache.struts.upload.FormFile"
     />

in my DynaActionForm. If your DynaActionForm has the
"org.apache.struts.upload.FormFile" object , then converter should work fine
. Matt Raible has a good example of writing your own converter , here is the
link :
http://www.raibledesigns.com/page/rd/20030113

HTH
Ivan


-----Original Message-----
From: Patrick Scheuerer [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 01, 2004 7:30 PM
To: Struts Users List
Subject: Need advice on data transfer between ActionFrom and Business
Bean


Hi,

I have the following ActionForm of type DynaValidatorForm:
     <form-property
         name="name"
         type="java.lang.String"
     />
     <form-property
         name="description"
         type="java.lang.String"
     />
     <form-property
         name="version"
         type="java.lang.String"
     />
     <form-property
         name="abstract"
         type="java.lang.String"
     />
     <form-property
         name="categoryDisplay"
         type="java.lang.String"
     />
     <form-property
         name="palModels"
         type="java.lang.String[]"
     />
     <form-property
         name="keywords"
         type="java.lang.String"
     />
     <form-property
         name="creationDateDisplay"
         type="java.sql.Date"
     />
     <form-property
         name="authorDisplay"
         type="java.lang.String"
     />
     <form-property
         name="roleDisplay"
         type="java.lang.String"
     />
     <form-property
         name="fileDisplay"
         type="org.apache.struts.upload.FormFile"
     />

The data of this form should be transferred to a value object with the
following
structure:

     private String _name;
     private String _description;
     private String _version;
     private byte[] _abstract;
     private Date _creationDate;
     private Vector _palModels;
     private Vector _keywords;
     private CategoryVO _category;
     private UserVO _author;
     private RoleVO _role;
     private File _file;

I also wrote the necessary bridge functions which convert the strings of the
form to the encapsulated value objects. The initial idea was to transfer the
data by reflection. The only problem is the form property FileDisplay of
type
FormFile.
As far as i know the reflection approach (using BeanUtils.copyProperties())
only
supports Strings and bools.

I would be very interested in how you would solve this problem. Of course I
could write a FormBean but if possible I would like to keep the luxury of
automatic form validation which the DynaValidatorForm gives me.

Any comments and suggestions are welcome.

I wish everybody a peaceful, prosperous and happy new year!
Patrick




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



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

Reply via email to