views:

300

answers:

1

We have a JSP page which shows details from multiple beans. Now, there is a requirement to edit the details of these individual beans and persist it into the database. So what we are doing is having one form with appropriate fields for each individual bean. But the ModelDriven interface allows only one object. So all the fields values will not get populated. And we cannot save the details. What can be done in this case???

+1  A: 

Probably you can wrap your beans into single Class and provide get/set methods?

public class ModelWrapper {
    private Bean1 bean1;
    private Bean1 bean2;

    public getBean1Param1() {
        return bean1.getParam1();
    }
    ...
    public getBean2Param1() {
        return bean2.getParam1();
    }
}
tevch