This chapter has introduced you to the world of servlet development. We started with a discussion of how servlets worked. Following that, you learned how to set up your development environment.
You learned how the HTTP protocol, the language of servlets, works. Following that, you learned how to create servlets using both the GenericServlet class and the HttpServlet class.
What is the difference between a servlet and a Java application running on the server?
What is servlet container?
What is the difference between the HTTPServlet class and the GenericServlet class?
What is a session object?
What is the difference between a cookie and a session object?
Create a servlet that echoes your name when called.
Create a servlet that lets you choose toppings on a pizza.
Modify the pizza servlet to use a session to accomplish this.
Move the creation of the HTML to be returned by the pizza servlet to a class in a package.
About the Authors
Steve Haines has worked in the enterprise software industry for the past eight years and has been focusing on Java since 1997. He has been filling key architectural roles in the areas of B2B e-commerce, high-speed Internet marketing, application monitoring and diagnosis, and robust client and server-side image layout and management over the past few years. He is currently the J2EE Domain Architect for Quest Software and is responsible for defining the expert rules for tuning and monitoring Enterprise Java applications and application servers.
He is the author of Que Publishing's Java 2 from Scratch and has numerous articles on InformIT.com in the areas of Java Swing and Enterprise Java. He shares author credits on Java Web Services Unleashed, C++ Unleashed, Sams Teach Yourself C++ in 21 Days, and Sams Teach Yourself Java in 21 Days. He has also worked as a technical editor for Pearson Education in areas of Java, Enterprise Java, Network Communications, C++, and video-game programming. Steve has taught all aspects of Java programming from basic certification training through Database, Web Development, and Enterprise JavaBeans at Learning Tree University (LTU). Steve recently enrolled in a Bachelor's of Biblical Studies at Calvary Chapel Bible College.
Steve Potts is an independent consultant, author, and Java instructor in Atlanta, Georgia. Steve received his Computer Science degree in 1982 from Georgia Tech. He has worked in a number of disciplines during his 20-year career, with manufacturing being his deepest experience. Steve has consulted for such companies as Home Depot, Disney, and IBM. His previous books include Java Unleashed and Java 1.2 How-To. He can be reached via email at email@example.com.
Source of this material
|This is Chapter 21: Servlets from the book Java 2 Primer Plus (ISBN: 0-672-32415-6) written by Steven Haines, published by Sams Publishing. |
To access the full Table of Contents for the book.
Other Chapters from Sams Publishing:Web Services and Flows (WSFL)
Overview of JXTA
Introduction to EJBs
Processing Speech with Java
The Java Database Control in BEA Weblogic
Databases and Tomcat
Working with JAX-RPC
Page 9 of 9