Developing Servlets

The development process for a servlet is straightforward:

1.
Design the Web interface to the servlet—usually an HTML page that invokes servlet functionality. For example, have an HTML form request that the servlet process its contents upon clicking the Submit button.
2.
Code and compile the servlet, making sure that the servlet class is designed to handle the HTTP requests of interest (such as POST or GET).

Let's see how this process works in terms of developing and deploying our example.

Designing the Servlet Interface

There's nothing magical or complicated about the HTML that leads to the invocation of the servlet. If you've written Web pages that invoke CGI functionality, Web pages that invoke servlets will look pretty ...

Get Building Scalable and High-Performance Java™ Web Applications Using J2EE™ Technology 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.