Chapter 21. Servlets

   

Java™ 2 Primer Plus
By Steven Haines, Steve Potts

Table of Contents
Part V:  Web Technologies


You will learn about the following in this chapter:

  • What servlets are why you need them

  • How servlets work

  • How to set up a Jakarta Web server to run servlets

  • How to program servlets in Java

  • How to call other Java classes from inside servlets

  • How to maintain the state of a servlet using cookies in the user's browser

  • How to maintain the state of a servlet using a session on the server

When Java 1.01 was released, it was heavily oriented toward the development of applications that can run in a browser. The Applet architecture had received a lot of consideration and most of that release supported the GUI classes that facilitated their creation. Almost immediately, the question was asked, "What about developing for the server?"

The Java language offers much more to the developer than cool Internet graphics. It is a robust, highly object-oriented language that is easy to learn. It has a small footprint, and it can run on almost any computer that you can name. It is supported by a host of standard extensions that enables you to perform tasks, such as managing sound and video, without making you learn a host of proprietary command sets and scripting languages. It was only natural for Java to become popular on the server as well.

Java's presence on the server side was initially through programs called servlets. Servlets, like applets, are intended to run in a container. The servlet's engine is not called a browser, however, but a servlet container. Both applets and servlets have to be written to a pretty exact specification, but the servlets cannot have graphical user interfaces. They can, however, extract data from HTML forms, and they can create HTML and send it to the client to provide visual feedback.

With the introduction of the Java 2 Enterprise Edition (J2EE), servlets became only one of many server-side technologies available to programmers. Enterprise JavaBeans (EJB) have become popular for complex applications, but servlets remain as popular as ever.

In this chapter, we are going to cover servlets from the developer's standpoint. First, you will learn how to obtain and install a servlet container on your machine. Next, you will learn how to develop, deploy, and run servlets. Following that, you will learn how to write servlets that maintain user information across transactions.


       
    Top
     



    Java 2 Primer Plus
    Java 2 Primer Plus
    ISBN: 0672324156
    EAN: 2147483647
    Year: 2001
    Pages: 332

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net