Servlet Configuration  «Prev 

SimpleServlet as served by the JSDK Server

Output of Simple Servlet
Output of Simple Servlet
  1. localhost: a special keyword identifying your own computer. 8080 is the port that JSDK server uses.
    (Most Web browsers try port 80 by default, so in this URL we tell the browser what port to use.)
  2. /servlet/SimpleServlet: the path to one of the sample servlets that comes with the JSDK.
  3. browser contents: the servlet output appears as HTML in the browser.

Historical Note

Tomcat has its origins in the earliest days of the servlet technology. Sun Microsystems created the first servlet container, the Java Web Server, to demonstrate the technology, but it was not terribly robust. At the same time, the Apache Software Foundation (ASF) created JServ, a servlet engine that integrated with the Apache Web server.
In 1999, Sun Microsystems donated the Java Web Server code to the ASF, and the two projects merged to create Tomcat. Version 3.x was the first Tomcat series and was directly descended from the original code that Sun Microsystems provided to the ASF. It’s still available and is the RI of the Servlet 2.2 and JSP 1.1 specifications.

Power of Java Servlets

Servlets can harness the full power of the core Java APIs: networking and URL access, multithreading, image manipulation, data compression, database connectivity, internationalization, remote method invocation (RMI), CORBA connectivity, and object serialization, among others. If you want to write a web application that allows employees to query a corporate legacy database, you can take advantage of all of the Java Enterprise APIs in doing so. Or, if you need to create a web-based directory lookup application, you can make use of the JNDI API.
When writing servlets, you can also pick and choose from existing third-party Java classes and JavaBeans components. Furthermore, you can use Enterprise JavaBeans components to communicate with servlets. Today, servlets can use thirdparty code to handle tasks such as regular expression searching, data charting, advanced database access, and advanced networking. Servlets are also well suited for enabling client/server communication. With a Java based applet and a Java-based servlet, you can use RMI and object serialization to handle client/server communication, which means that you can leverage the same custom code on the client as on the server. If you were to use CGI for the same purpose, it would be more complicated, because you have to develop your own custom protocol to handle the communication.