I have two concrete classes, Person1 and Person2 extending Person. I want a spring jsp form to create a Person1 or a Person2.
public abstract class Person{
}
public class Person1 extends Person{
}
public class Person2 extends Person{
}
I have some field in html form describing the class type (Person1 or Person2). How can I automatically create a Person by using the @ModelAttribute annotation?
public String create(@ModelAttribute Person person){
// person here can be instance of Person1 or Person2
...
}