jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes Controller servlet gets messy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Controller servlet gets messy" Watch "Controller servlet gets messy" New topic

Controller servlet gets messy

Derek Bright

Joined: Aug 28, 2008
Posts: 28
hi, i have a controller servlet but it seems to get too messy as my project is rather huge. Is there a way to simplify my controller servlet, say like creating another controller from the main controller servlet, OR there are better ways? Thanks~
Sudarshan Chakrabarty
Ranch Hand

Joined: Apr 10, 2008
Posts: 38
Why don't you try out Struts ?
arulk pillai
Ranch Hand

Joined: May 31, 2007
Posts: 3359
Are you using a front-controller pattern? You seem to be having a separate servlet for each type of request? You can try and use composition (preferred) or inheritance to separate out reusable comon logic.

[Java-Success.com] | [Java job hunting know how] | [Java resumes]
Gopikrishna Kunisetty
Ranch Hand

Joined: Jun 12, 2008
Posts: 35
Hi Derek Bright,
Can you add more details about your problem?

- Krishna<br /> SCJP 1.4 SCWCD 5
Derek Bright

Joined: Aug 28, 2008
Posts: 28
hmm... i try to summarize

under my web.war i have a servlet controller which directs the request to the respective jsp. To make things less complicated in the controller, i have create separate java class (act as managers) to communicate with the session beans. The controller would only need to call the java class manager. However, i still find the codes in controller rather long. So how can i solve this?

controller -> manager -> session beans
then controller dispatches the necessary jsp file.

Hopefully you get what i am trying to say...
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63343

Please read this article, and if interested, check out my Front Man controller implementation.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link: http://aspose.com/file-tools
subject: Controller servlet gets messy
It's not a secret anymore!