You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Patrick Scheuerer <ta...@hispeed.ch> on 2004/01/02 01:30:27 UTC
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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org