Is it possible to make "SomeTestClass" dynamic? I have 10+ beans that will map to form fields on 1 page and I don't want to create 10 different methods in my controller.
It should be possible but as you sample is right now, Spring MVC doesn't know which subclass to create. Add an @ModelAttribute method to help instantiate the right subclass:
Code:
@ModelAttribute
public SomeTestClass createSomeTestInstance(...) {
// Create and return correct instance of SomeTestClass ...
}
Given the above Spring MVC will use your method to populate the model and then it will simply access it from there by the time it gets to the @RequestMapping method.