Passing Parameter Data to a Servlet

Your first servlet, although it shows the principle of servlets, was not actually a very good servlet example. As you have probably realized, it could have been written as a static HTML page and you could have avoided all the complication of having to write and compile a servlet. The next example will show the power of servlets.

How to Access Parameters

Servlets are most useful when the data is dynamic. Dynamic data can come from many sources. It can be obtained from an external resource (such as a file, database, or another Web page) or it can be user input sent from an HTML form to the server in the form of parameters.

Parameters are name-value pairs specified in the GET or POST request. Parameters can be ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.