I've found that my problem is that my Customer instance was not initialized
in the Form class, but I wouldn't have thought this should be necessary in
Struts. This then also means that any other complex java objects within
customer would need to be instantiated (i.e. Address) and so on if Address
had other complex java objects.

So it works fine if in the form I define:
Customer customer = new Customer();

Also, if I invoke an Action class and create a new instance of customer in
the Customer form and then forward to the customer jsp, it displays the new
instance values ok, but it still doesn't work when submitting the form if
the Customer instance in the form is not instantiated (customer is null
again).

Chico.

-----Original Message-----
From: Jon Ferguson [mailto:[EMAIL PROTECTED]] 
Sent: 08 March 2002 09:12
To: Struts Users Mailing List
Subject: Re: Populating complex java objects in forms

Do you have the appropriate setXXX() method on the customer for name?
Jon

"Charlesworth, Chico" wrote:

> Hi,
>
> If I've got a complex java object (i.e Customer) in the Form class, I can
> then read off this object in the jsp page, but when submitting to the
Action
> class the Customer object is null.
>
> The jsp would look like:
> <html:form action="/updateCustomer">
>         Customer Name: <html:text property="customer.name"/>
>         <br>
>         <a href="javascript:document.forms[0].submit();">Update
Customer</a>
> </html:form>
>
> So this would display the current customer name, but if I change the
> customer name and then hit the submit link, I find the customer instance
is
> now null in the updateCustomer action class.
>
> Am I doing something wrong, or is it not possible to populate complex java
> objects in the jsp form using struts?
>
> Cheers,
> Chico.
>
> --
> The content of this e-mail is confidential, may contain privileged
material
> and is intended solely for the recipient(s) named above. If you receive
this
> in error, please notify Software AG immediately and delete this e-mail.
>
> Software AG (UK) Limited
> Registered in England & Wales 1310740
> Registered Office: Hudson House, Hudson Way,
> Pride Park, Derby DE24 8HS
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


-- 
The content of this e-mail is confidential, may contain privileged material
and is intended solely for the recipient(s) named above. If you receive this
in error, please notify Software AG immediately and delete this e-mail.

Software AG (UK) Limited
Registered in England & Wales 1310740
Registered Office: Hudson House, Hudson Way,
Pride Park, Derby DE24 8HS

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

Reply via email to