Best Practices for Implementing Servlets
As we've seen, servlets offer a powerful mechanism for integrating Web servers and enterprise-wide business components. Now let's look at some of the best practices that are adopted in enterprise applications that involve servlets as one of the layers.
Leverage the MVC pattern— Use servlets as controllers, as described in the MVC pattern. Presentation is typically done using a JSP and the servlet is left to invoke the business component and pass on the necessary data for the presentation layer.
Use of SingleThreadModel— SingleThreadModel servlets should be avoided because most of the servlet container implementations have a huge system overhead. Instead use thread synchronization when necessary.
Use
Get BEA WebLogic Server™ 8.1 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.