Try looking at the BeanUtils.copyProperties method call...


Thomas Peters

Senior Consultant
Aidera Solutions

Telephone: 603-888-7700
Mobile: 603-566-5406
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 29, 2001 11:45 AM
Subject: Using non-form beans in a form...


>
> I can create an html form and associate a bean with it (i.e. <html:form
> name="Bean" type="com.package.Bean">).  When I do this, I am happy to see
> all of my form fields populated with values that they retrieve from the
> getters in the bean.  However, when I update those values, it appears that
> I have to retrieve them from the request object and then place them into
> the bean (i.e. it isn't done automatically as it would be if I were to use
> a struts form bean).
> So, I guess my question is simply: is there any way for this bean to be
> updated automatically?  If the answer is no, then I'm assuming the only
way
> to do this is to create a "form-bean", prepopulate it with the values from
> my bean, display it, and then take the changed values from the form-bean
> and set them into my model bean.  The thing that seems odd about that is
> the two beans look almost identical - they have the same setters and
> getters.  It seems a little redundant to make a "form-bean" for every
> "model-bean" that you want to represent through the use of a form.
>
>

Reply via email to