CHAPTER 2: Building Web Applications Using Servlets and JSP 69
The IDE generates the HelloWorld servlet illustrated in Listing 2-12.
Listing 2-12. HelloWorld Servlet Using Annotations
1.package apress.helloworld;
2.
3.import java.io.IOException;
4.import javax.servlet.ServletException;
5.import javax.servlet.annotation.WebServlet;
6.import javax.servlet.http.HttpServlet;
7.import javax.servlet.http.HttpServletRequest;
8.import javax.servlet.http.HttpServletResponse;
9.
10./**
- Servlet implementation class HelloWorld
- */
13.@WebServlet(urlPatterns = { "/HelloWorld" }, description = "A hello world servlet")
14.public class HelloWorld extends HttpServlet {
Figure 2-20. Specifying methods