1

I want to have a form that creates one of several subclasses in a type hierarchy. Say it's AbstractPerson with the subclasses Employee and Visitor.

Can I do that with a single Action / REST-Controller Bean?

Usually I use the form-ids smart, so it assigns values directly to the setters of my Action. So if I have a member like

AbstractPerson member;

I would try to use a form with an input field called "member.name".

However, struts must create an instance of AbstractPerson first - and it can't because it's abstract! It would be very cool if I could give struts2 a hint that it should actually create a Empolyee or Visitor object (depending on the form content). Is that or sth similar possible?

Cheers!

4

1 に答える 1