This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Servlet is the best example of OOP. Your web application is usually a number of screens, most of screens have something in common, some screens look similar to others. So you do the following: 1. define a base servlet taking care of common content and behavior of all screens 2. inherit servlets from the base to serve particular screens 3. build more complex hierarchy for servlets servicing similar screens, like reports, form processor and so on. Using OOP reduces amount of developed code drastically. You need just override a few functions of base servlet and get completely different behavior. It's very powerful approach.
Maybe I should write a book about that, who knows?
Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
The actual servlet spec and classes are a small part of an application. You can apply OO Design Principles to your systems whether you start from a servlet framework or not. Read up on those principles and see the kinds of things we tend to care about.
If those make good sense, google for "MVC model 2" which is recipe for separating the responsibilities of servlets, JSP pages and a Plain Old Java Object business model.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi