One trick is to move all the code out of your
servlet into a threadsafe class:
WorkerClass is not shared by multiple threads the way Servlet is, so it can use member variables. The vendor framework I'm using now does this. There is essentially one servlet that gets the right worker class for the request from a factory.
What's the downside? They must have designed servlets the way they are for some reason. The servlet design - one instance shared by many threads - reduces object creation and destruction. This trick guarantees one object created per request. How much does that matter? Anybody know? Any other pros & cons?
Editing - I just noticed you asked JSP and I answered Servlet. I haven't written enough JSP to know just how much the difference matters ... waddya think?
[ July 19, 2004: Message edited by: Stan James ]