I'm writing a web project using MVC design pattern (with DAO to access database) that will run on a Tomcat server.
What is concretely the model on my tomcat server ?
Version 1 My current interpretation is : the Model is a set of java objects that stay on my server using a static java class that will store the objects. Periodically, it uses a DAO to check the DB and update itself. The controller, when called by the view, checks that model and returns the appropriate informations to the view.
Version 2 But a teammate thinks : nothing is persistent on the server. When the controller is called, it calls the DAO that checks the database, create a Java object of the model and gives it to the controller. The controller finds in it the informations it needs, returns these infos to the view (and the java object from the model is destroyed by the garbage collector at the end of the controller).
How does a server work ? What is the right interpretation ? Thanks for any help or advice.
Aucun commentaire:
Enregistrer un commentaire