Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

optimum number

 
eswar kumar
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what are the optimum no of servlets required for a project?
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by eswar kumar:
what are the optimum no of servlets required for a project?

there's no optimum number of servlets. It all depends on how you architecture your application and how complex it is. You can use a single servlet to do *all* tasks if you want, but at the end you'll find yourself in a complete chaos
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34974
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some frameworks, like Struts, have one servlet. That servlet delegtes all responsibilities to other classes. That way the servlet doesn't grow in complexity and the separate actions stay manageable.
 
Tim Baker
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so it depends on if you want to put all your code in servlets or not. if you do then each servlet should have a very specific task. if there are multiple pages that do the same sort of thing then they can be done in the same servlet, but very different pages should have their own. if you have shared functions accross different pages then you need to abstract the code into classes and use it accross the different servlets.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic