★ wanayoo — archive 1999 http://www.java.sun.com/features/1998/06/servletapi.htmlNouvelle recherche | Portail wanayoo
Java Technology Home Page
Downloads, APIs, Documentation
Java Developer Connection
Docs, Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide

A-Z Index

The Source for Java Technology

JAVATM SERVLET API POWERS SERVER-SIDE APPLICATIONS


Java Servlet Series


Edited by Phil Bartholo

How can web applications use the JavaTM servlet API?

Most servlet web applications implement the HttpServlet interface. Incoming http requests are routed to the doGet() and doPost() methods which process incoming data and output html for display. These methods accept HttpServletRequest and HttpServletResponse objects as parameters. HttpServletRequest provides many methods that make it easy to access any information relayed with the http request such as form parameters and cgi variables. And HttpServletResponse provides methods to facilitate output functions such as setting the context and outputting HTML.

Servlets can also define the init() and destroy() methods that run when the servlet is loaded or unloaded by the web server. Since servlets only need to be loaded once and each request is threaded through the same instance, the init() method is ideal for setting state variables that can be shared accross multiple requests. Meanwhile, the destroy() method can be used to graciously finish existing user requests when the servlet is unloaded. Additionally, persistence can be taken a step further with the use of the HttpSession class which allows web applications to keep information about a specific user.

Our previous Java servlet profiles showed how all the benefits of the Java language extend to server-side web applications. Besides these advantages, servlet developers get the added benefit of the robust Java servlet API, which provides a logical way to organize development and a rich set of features ideal for dynamic web applications. This profile illustrates how the Java servlet API takes server-side applications to new heights.

The Java servlet API is a Standard Java Extension API initially supported by the Java Web ServerTM. Currently most commercial and freeware web servers have adopted extensions that support this API. The interface helps to power servlets by facilitating form data input, HTML services, and state persistence in ways never dreamed of with legacy CGI applications.

Union Pacific Railroad

"The future as we see it is in allowing customers to conduct core business transactions with us over the Web, and we see Java applets and servlets combined as being one of the key technologies to enable this business to business activity."

-- Tom W. Gerber, Union Pacific Railroad

The Union Pacific Railroad web site reflects the corporation's goals of creating new ways of doing business, providing open communications, promoting safety, and offering new avenues for demonstrating good corporate citizenship. The site offers dynamic customer information materials, such as equipment tracing and pricing information. Additionally, the site also enhances the railroad's supplier relationships by enabling business to business transactions with its fuel and material suppliers.

Why Union Pacific Railroad Chose Java Servlets

We spoke with Tom W. Gerber of Union Pacific Railroad about the company's development efforts using Java servlet technology.

How did Union Pacific Railroad benefit from the Java servlet API?

Initially, Union Pacific chose the Java programming language because they wanted to develop their CGI applications with the same language that they used for applets."We started writing Java CGI programs in 1996 before there was a servlet API. The challenging part was learning how to best leverage the Java language and writing good clean objects that could be reused."

As servlet technology matured, Gerber realized the added benefits of the servlet API. "The O'Reilly WebSite server came out with their own server-side Java API before Sun's own was published, and we converted to servlets to get the performance improvements. We are now converting to Sun's Java servlet API to get platform independence."

How are servlets used on the Union Pacific Railroad web site?

Union Pacific Railroad chose servlets for their mission-critical dynamic web processes that help customers track shipments and suppliers trace invoices. Gerber explains: "Most of our key business to business applications are being written with servlets. This includes our tracing features as well as future applications that are replacing our DOS/Microsoft Windows proprietary packages."

Other Installments in the Java Servlet Series

Java Servlets Boost Shopper's Tool

The Word Spreads: Developers Abandon CGI in Favor of Servlets

The Ultimate Connection: Servlets Meet Enterprise Databases

Steaming Hot Servlets: A discussion with Proxicom about their servlet development

See Also

JavaServerTM Product Family, home page for information on Java Server products.


Reader Survey
I found this article...   very worth reading    worth reading    not worth reading
Comments:
 
Other Recent Features


[ This page was updated: 18-Oct-99 ]

Products & APIs | Developer Connection | Docs & Training | Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World
Feedback | Map | A-Z Index

For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-99 Sun Microsystems, Inc.
All Rights Reserved. Legal Terms. Privacy Policy.