The server cannot tell the difference between an input field that was
visible (<html:text>) and invisible (<html:hidden>) -- when the form is
submitted, they both look the same.  Therefore, your problem is being
caused by something else.  Likely culprits:

* No setter method (or a case match problem).

* More than one setter method with different datatypes (this is not
  allowed by the JavaBeans spec, so it will cause Java to think there
  is no such property on this bean).

Craig

On Mon, 30 Sep 2002, Charles McClain wrote:

> Date: Mon, 30 Sep 2002 08:40:53 -0400
> From: Charles McClain <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: Struts User Mailing List <[EMAIL PROTECTED]>
> Subject: <html:hidden> fields
>
> All:
>
> I have what seems to be a fairly common situation which is not producing
> the results I expected:
>
> On my JSPs and in my ActionForms, I have a field which represents an
> artificial key for a database table.  On an update, this field will have
> a value, but on a create, it must be null.
>
> I populate the ActionForm from a data bean, and as long as the field on
> my JSP is an <html:text>, everything works fine -- the form gets
> populated, and, on a commit (for an update), the key gets populated in
> the data bean just before the database operation.
>
> However, I don't really want my users to see the artificial key or,
> indeed, even know that there is such a thing, so I changed the field on
> the JSP to an <html:hidden>.  Now the value in the data bean no longer
> gets populated.  This doesn't seem to be a function of the
> BeanUtils.populate() method, since the API documentation simply says
> that that all properties of the source bean for which the target bean
> has a property of the same name -- and a corresponding setter method --
> will be transferred.  Okay, my key field passes that test.  Can anyone
> tell me why it doesn't get transferred to the data bean?
>
> Charles McClain
> Phone:  603.659.2046
> email:    [EMAIL PROTECTED]
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


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

Reply via email to