Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
    Bookmark Topic Watch Topic
  • New Topic

Single Servlet Controller vs. Multiple Servlet Controllers

 
maneesh subherwal
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Report post to moderator
All,
I have a question that folks here at JavaRanch may be familiar.
Using Tomcat's Specifications and the MVC pattern, is it better to use a single servlet controller or several servlets, one for each action, for a large application, in terms of container overhead and/or maintenance?
I believe I am using a SingleThreadModel for my servlets.
e.g.
SingleControllerServlet?UpdateDB
SingleControllerServlet?RetrieveFromDB
OR
UpdateDBServlet
RetrieveFromDBServlet
In case 1, I send the function as part of the queryString while in case 2, each servlet performs its own function and has less logic processing to do.
Thank you.
cyberCipher
 
Faisal Khan
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have not much experience with developing model 2 apps since my main app was a kludge of different things. I recently came to re-do the application and I decided to got for the model 2 architecture for obvious reasons. After some brief development using a single controller it became a bit of a mess with tonnes of if/else statements.
I have now decided to go with a proven technology and use the Struts framework as a controller. This way all the mappings can be done in an XML file and thus the obvious advantage of leaving the code alone. Of course the disadvantage at the moment is that I have to learn Struts API but its not too complex and learning new things can not be a bad thing.
I hope this answer helps, your question is one of great importance and I would get advice from the main Servlets forum as a lot more are likely to contribute to it, as this forum is specific for those preparing for the exam.
I'll stop typing now.
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello "cyberCipher" --
We're pleased to have you participating in the Saloon. There aren't too many rules about posting -- at least we hope people think so -- but we do have a naming policy that we require everyone to observe. Please take a moment to review it and change your screen name so that it complies.
We hope you find the Saloon a productive and useful place. Thanks for your attention to this matter.
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
It turns out this was also cross-posted in the Servlets forum, so I'm closing it here.
 
    Bookmark Topic Watch Topic
  • New Topic