You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by gu...@systor.com on 2001/07/02 11:21:01 UTC

Re: Using non-form beans in a form...

Hi

I had similar problems. I had to get my action configuration in 'web.xml'
and 'struts-config.xml' right, and then Struts did update the Bean
correctly.

Hope this helps.

Guido



                                                                                                                
                   "Thomas Peters"                                                                              
                   <tpeters@aidera       To:  <st...@jakarta.apache.org>                                  
                             .com>       cc:                                                                    
                                         Subject:  Re: Using non-form beans in a form...                        
                                                                                                                
                        29.06.2001                                                                              
                             18:59                                                                              
                    Please respond                                                                              
                    to struts-user                                                                              
                                                                                                                
                                                                                                                


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: <Da...@ovid.com>
To: <st...@jakarta.apache.org>
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.
>
>