One of the most exciting and dynamic areas of growth in Java is the use of a Web server as an application development platform. The Java language has moved beyond applications that run on your computer and applets that run on a World Wide Web page.
Servlets, Web applications run by a server over the Internet and presented by a Web browser, employ Java without the prohibitive security restrictions in place for applets. A servlet can use all the features of the language. Using servlets, you can collect input from users through Web page forms, present records from a database or another source, and create Web pages dynamically. This approach can be enhanced by JavaServer Pages (JSP), a way to create Web pages that mix static HTML with the output of servlets and Java expressions.
JavaServer Pages enable nonprogrammers to work on Web sites developed with Java.
In this chapter from the book SAMS Teach Yourself Java 2 in 21 Days, by Rogers Cadenhead and Laura Lemay, you'll learn about the following topics:
How servlets differ from applications and applets
How to run servlets as part of the Apache Web server and other servers
How to receive data from a Web page form
How to store and retrieve cookies
How to use servlets to dynamically generate Web content
How to create a JavaServer Page
How to use Java variables, expressions, and statements on a page
Click here to download this free book chapter.