If your web app is complex enough that the number of actions may exceed the number of servlets you are comfortable handling, then you might consider a web framework to abstract
that problem away.
Your servlet layer should only do a few things:
- Yank input from request
- Manage session state
- Dispatch objects to/from Business object layer
- Push data into the response
- Forward to a view
- Handle errors/bad input/output
Almost anything else stuck into a servlet is a bad idea.
If you follow some simple guidelines, a simple servlet can call an input processor to turn data from the request and data that might be in the session into an appropriate object. That object can then be passes to a BizObject layer. That layer will return information that might be stored in the session and some object that will be passed to the view.
I used to enforce a 40 line rule for servlet service methods. If you went past 40 lines, I expected a good explanation.
I worked on an 80k line java web app that had two servlets, neither exceeded 40 lines. It handled about 60 forms/states.
At no point did I think it would be easier to manage/maintain/modify the app if more code were in the servlet.