• Post Reply Bookmark Topic Watch Topic
  • New Topic

Best way to write a model

 
Ramkumar Subburaj
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am developing a web application using servlets, JSP and MVC framework.

So my servlet calls the appropriate model depending on the work and dispatches the response according to the result from the model.

i have a Servlet to perform view, edit and add product .\
Should i write a single model say ProductModel and write all the 3 methods inside it or should i write 3 different models for viewing, adding and editing.

(please correct me if i am wrong) I feel if i write all the 3 models in the same class and suppose i want to edit the product, i instantiate the ProductModel and all the 3 methods get loaded in the memory occupying unnecessary space.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you might be interested in exploring the DAO pattern.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!