Chapter 22: Creating Java Servlets
The Java Servlet API is a Java Standard Extension Java classes that extend the functionality of a Web server.
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:
Act as a gateway between HTML forms and EAServer components Your client application consists of an HTML page with embedded HTML forms that submits the data to the servlet. When invoked, the servlet calls EAServer components, supplying the form data as parameters. For simple user interfaces, HTML forms can offer better performance than Java applet clients, since the browser does not download applet code.
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 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.
describe how to code servlet classes.
|Copyright © 2005. Sybase Inc. All rights reserved.|