Modeling Servlets in UML

The GenericServlet class is usually modeled as a standard Java class with the <<Generic_Servlet>> stereotype applied. The presence of the stereotype allows for the servlet to be represented in a compact form and still be easily distinguished as a generic servlet without the need to show the inheritance tree on the same diagram. A generic servlet can include any of the life cycle methods or the convenience method discussed earlier.

A more expanded view of the servlet class showing the inheritance from the GenericServlet class can also be used. In most cases, though, the more compact stereotyped class view is sufficient. The compact and expanded representations of the servlet are shown in Figure 10-5.

Figure 10-5. Compact ...

Get Developing Enterprise Java Applications with J2EE™ and UML 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.