Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Single Servlet Controller vs. Multiple Servlet Controllers

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
It turns out this was also cross-posted in the Servlets forum, so I'm closing it here.
 
"How many licks ..." - I think all of this dog's research starts with these words. Tasty tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
    Bookmark Topic Watch Topic
  • New Topic