tags:

views:

315

answers:

1

I have a Struts (1.3x) ActionForm that has several String and boolean properties/fields, but also has some POJO fields.

so my form looks something like:

MyForm extends ActionForm {
    private String name;
    private int id;
    private Thing thing;

    ...getters/setters...
}

In the JSP I can reference the POJO's fields thusly:

<html:text property="thing.thingName" />

...and the values display correctly, but if I try to submit the form I get the ServletException: BeanUtils.populate error.

There seems to be a lot of information about this general topic on the web, but none really addresses my specific question, which is: shouldn't I be able to submit a form in Struts that contains fields that are POJOs?

+1  A: 

You can, as long as the fields follow the JavaBean conventions and the setter takes something Struts can understand.

So Thing needs getThingName() and setThingName(String).

Mwanji Ezana