Chapter 2

Creating Servlets

IN THIS CHAPTER

check Looking at servlets

check Downloading, installing, and configuring Tomcat

check Creating simple servlets

check Working with forms to get data from the user

Servlets are among the most popular ways to develop web applications today. Many of the best-known websites are powered by servlets, including Gmail, Amazon, LinkedIn, and eBay. In this chapter, I give you just the basics: what a servlet is, how to set up your computer so that you can code and test servlets, and how to create a simple servlet. The next two chapters build on this topic, presenting additional web programming techniques.

Understanding Servlets

Before you can understand what a servlet is and how it works, you need to understand the basics of how web servers work. Web servers use a networking protocol called HTTP to send web pages to users. (HTTP stands for Hypertext Transfer Protocol, but that won’t be on the test.) With HTTP, a client computer uses a uniform resource locator, or URL, to request a document that’s located on the server computer. HTTP uses a request/response model, which means ...

Get Java All-in-One For Dummies, 5th Edition 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.