File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

Controller servlet gets messy

Derek Bright
Greenhorn

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
Author
Ranch Hand

Joined: May 31, 2007
Posts: 3220
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 Interview Questions and Answers Blog | Amazon.com profile | Java Interview Books
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
Greenhorn

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?

overview:
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
Marshal

Joined: Jan 10, 2002
Posts: 61218
    
  66

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]
 
wood burning stoves
 
subject: Controller servlet gets messy