That's why Struts supports nested beans.  Just make a form-bean that handles
your non-form bean.  I hope this is you're talking about, just ignore my
references to interface and read Tony's message: @see:
http://marc.theaimsgroup.com/?t=99230991400002&w=2&r=1


Anthony

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 29, 2001 8:45 AM
To: [EMAIL PROTECTED]
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