Understanding what a servlet does and how it is coded
In Java web programming, there is no main method. Instead, all applications must have at least one servlet. When we look at Jakarta Faces’ client-side rendering, there is no servlet, as it is already part of the library. Let’s look at a servlet.
The first line is an annotation that defines that this class is a servlet. The description is visible in the server’s admin console. The urlPattern
attribute is the name you use in a URL. A servlet can be named anything and can have any extension, although the standard practice is to not have an extension. A servlet can have multiple patterns. Here is an example of a servlet:
@WebServlet(description = "Basic Servlet", urlPatterns = {"/basicservlet"})
If we wished to refer to this servlet with more than one pattern...