• Post Reply 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MVC Servlet ??

 
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I've been working on a web application that consists of jsp's beans and 1 servlet as the controller. I read somewhere that all I need is 1 servlet as the controller. The servlet is getting pretty big. Should I use 1 servlet as just the controller and then uses some other servlets to handle actions, or is it okay that this one servlet is getting pretty big?
Thanks,
Sean
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Couldn't give a perfect answer, but in previous projects the only time we had a single servlet acting as the controller for the entire application was when the flow of control was clearly defined.
That is, there was a clear path that the user had to follow and there was little ability for them to go outside this. Therefore, by having a single controller they were forced to take one step after another regardless of the Servlet the thought they were requesting.
Dave.
 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To my knowledge, you can have a number of servlets in your application as controllers.
You could design different servlets to be invoked based on user action/business funtion/etc. This way you could have smaller (sized) servlets that accomplish your task.
------------------
_________________________
Rama Raghavan
SCJP2
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why don't you just use a configuration file and put the action classes you want to load in there ?? like;
com.mybuziness.sate.ActionWhatever
create a new instance of it and forward ?

I think the BEST solutions for you would be to use a ready made MVC system!! Take a look at STRUTS!!
http://jakarta.apache.org/struts
Dave
 
Sean Casey
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all the replies. I appreciate all your answers. I was just wondering what other people thought. I checked out struts. It's looks pretty useful. I wanted to create an application following the MVC pattern. It's coming along quite nicely, although my controller servlet is getting a bit bulky, so I just wanted to know what other people did when they came into this situation. I figure I can keep the bulky controller servlet, or keep one strict controller servlet and have a few more smaller servlets that handle requests for specific actions. I'm not sure what I'll do yet though. Thanks for your input.

 
reply
    Bookmark Topic Watch Topic
  • New Topic