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 compile and deploy a servlet. The next example will show the power of servlets.
How to Access Parameters
The power of servlets comes into its own 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 sent from a HTML form to the server in the form of parameters.
Parameters are name-value pairs. Parameters are defined in the HTML, for example
Get Sams Teach Yourself J2EE™ in 21 Days 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.