I would like to ask a question on how I decided to implement the MVC pattern for a simple javaEE application (when I say javaEE I mean pure javaEE without any additional framework, so: servlet, jsp ejbeans...). My mvc works in this way:
Actors:
- view -> a set of jsp pages;
- controller -> a single servlet;
- model -> a set of non-instantiable java classes containing static methods.
Functioning: each user request is managed by the servlet which decides the correct static method to call among the classes of the model. In particular, each form in the jsps contains 3 hidden fields: classToCall, methodToCall and destionationPage. Once the servlet receives the http post, it reads these 3 hidden fields and
- call the right method in the right class via reflection passing the HttpRequest as parameter
- forwards the user to the correct jsp which displays the result of the computation.
My main doubt regards the implementation of the model as "static" classes: since many frameworks tipically handle user requests by creating a bean on the fly and calling an instance method of it, I would like to know if my "static" model can have any "contraindication".
Thanks a lot for your help, bye Nico