What is a better way of writing servlets?

Badri Kuppa

I think the 2nd option is best, becauase

1. By using the first one, you will have lots of if..else..conditions and even the code won't be easily readable!

2. Performance increases by 2nd option as the load on one single servlet is less. [This is not necessarily so, since any servlet is just code being executed in a JVM thread; unless it's synchronized, then you can have as many requests as you want inside a single servlet. -Alex]

3. IBM states "Do one thing at a time, Do it well" which suggests the 2nd option.

4. Easy to mentain the code if it is broken by functionality.

I hope this helps you. --Badri