To summarize, there are three sorts of interservlet communication:
Servlet manipulation, where one servlet directly invokes the methods
of another. These servlets can get references to other servlets using
getServletNames() and getServlet(String
name), but they must be careful not to use stale references
to servlets that have been reloaded.
Servlet reuse, where one servlet uses another's abilities for
its own purposes. In some cases, this requires forcing a servlet load
using a manual HTTP request. These servlets also have to be careful
not to use stale references.
Servlet collaboration, where cooperating servlets share information.
Servlets can share information using the system properties list
(saving strings or objects), using a shared object (a singleton found
in the server's classpath), or using inheritance.
Copyright © 2001 O'Reilly & Associates. All rights reserved.