Chapter 22: Creating Java Servlets  Writing servlets for EAServer

Chapter 22: Creating Java Servlets

Introduction to Java servlets

The Java Servlet API is a Java Standard Extension Java classes that extend the functionality of a Web server.

Use of servlets in EAServer

Java servlets respond to HTTP requests from Web browser clients (or any other client that connects to EAServer using the HTTP protocol). You can associate an HTTP URL with a servlet that you have installed in EAServer. The servlet can dynamically create HTML documents, or act as a gateway between HTML-forms based applications and EAServer components. For example, you might create servlets to:

EAServer provides an extended version of the Servlet API so that servlets may use EAServer services such as inter-server component invocations and database connection caching.

Java servlets versus Java components

Java servlets enhance the functionality offered by Java components, but do not replace Java components. Servlets in EAServer can be invoked only by HTTP clients, and must return all output by writing to a ServletOutputStream instance. Typically, servlets are invoked from HTML pages loaded in a Web browser and return formatted HTML as their output.

Java components can be executed by any EAServer client model, and can return complex objects in their natural format. To invoke Java components from a Web browser, you must create a Java applet that connects to EAServer and instantiates proxy objects for the component.

Servlets can make use of some, but not all, server-side services; for example, servlets can use cached database connections and can issue in-memory calls to components installed on the same server. Servlets cannot, however, participate in EAServer transactions, except as a base client. Servlets cannot use other server-side APIs besides connection caching and the Java ORB.

Java components have access to all Java server-side APIs and can participate in EAServer transactions.

For more information

The JavaSoft Servlet Web pages

describe how to code servlet classes.

Copyright © 2005. Sybase Inc. All rights reserved. Writing servlets for EAServer