mercredi 26 octobre 2016

Switch behavior from Form Checkbox [MVC]

Im using Spring MVC and making a website where the user can upload a file and select many methods of analysis.

These methods may vary with the time (new implementation, removal of older implementations). So I want to flexible for when I add new analysis methods.

Basically, I would like to have a view with Checkboxes where the user can check what he wants to do:

[X]Do this
[ ]Do that
[X]Recently Added "do method"
[Submit]

Then, the controller will get te result from this view and decide what to do. I was thinking about using a facade service that executes all the logic from what was added, relying on a IAnalysisMethod interface that implements a "execute()" function.

But how could I get those generically from the form (the checkboxes only have true/false values) without having to mess with the controller for every time I add a new Method? Would that have to do with a "AnalysisOption" class for modeling the form? Would it be problematic if this class were not a Java Beans (had a method where the booleans were made into IAnalysisMethod classes)?

Suggestions?




Aucun commentaire:

Enregistrer un commentaire