All right guys, I am working on this project where there are 2 classes, Customer and Address which has a one to one relationship.(Customer has an Address)

I created a Customer Action form which returns a customer object and since the address is part of Customer object, I added Address setters/getters inside the Customer form (though they are 2 separate entity classes). But for some reason, I cant return address from the Customer form. Its getting null value. I have the getters/setters for both customer and address inside the form and getCustomer() works fine but not getAddress().

Is it Ok to include 2 objects inside a single Struts form?

These are my codes:

Java Code:
public class CustomerForm extends org.apache.struts.action.ActionForm {

    public static Logger logger = Logger.getLogger(CustomerForm.class);
    private Customer customer = new Customer();
    private Address address = new Address();
 

    public CustomerForm() {
        super();
       
    }

   

    public Customer getCustomer() {
      
        System.out.println("inside customer form");
        return customer;

    }

    public int getId() {
        return customer.getId();
    }

    public void setId(int id) {
        customer.setId(id);
    }

    public String getFirstName() {
        return customer.getFirstName();
    }

    public void setFirstName(String firstName) {
        customer.setFirstName(firstName);
    }

    public String getLastName() {
        return customer.getLastName();
    }

    public void setLastName(String lastName) {
        customer.setLastName(lastName);
    }

     public Address getAddress() {
        return address;

    }
    

    public String getState() {
        return address.getState();
    }

    public void setState(String state) {
        address.setState(state);
    }

    public String getCity() {
        return address.getCity();
    }

    public void setCity(String city) {
        address.setCity(city);
    }

    public String getEmail() {
        return address.getEmail();
    }

    public void setEmail(String email) {
        address.setEmail(email);
    }

    public String getPhone() {
        return address.getPhone();
    }

    public void setPhone(String phone) {
        address.setPhone(phone);
    }

    public String getStreetAddress() {
        return address.getStreetAddress();
    }

    public void setStreetAddress(String streetAddress) {
        address.setStreetAddress(streetAddress);
    }

    public String getZipcode() {
        return address.getZipcode();
    }

    public void setZipcode(String zipcode) {
        address.setZipcode(zipcode);
    }

  
   
}
This is my Customer Action class which calls the form:

Java Code:
    Customer customer = new Customer();
            Address address = new Address();

     
            System.out.println("getting Customer in CustomerActionn");
            customer = ((CustomerForm) form).getCustomer();

 System.out.println("getting Address in CustomerActionn");

            address = ((CustomerForm)form).getAddress();
            customer.setAddress(address);

  System.out.println("street address inside customer action is "
                   +address.getStreetAddress());-------------- this returns null
           System.out.println("name inside customer action is "
                    + customer.getLastName());----------- this returns lastname
    

         System.out.println("street address inside customer action is "
                    + customer.getAddress().getStreetAddress());-------returns null
How do I fix it?