Java Servlet (original) (raw)
The Java Servlet API allows a software developer to add dynamic content to a web server using the Java platform. The generated content is commonly HTML, but may be other data such as XML. Servlets are the Java counterpart to dynamic web content technologies such as CGI or ASP. However, unlike CGI, (but like PHP), it has the ability to maintain state after many server transactions. This is done with a combination of HTTP Cookies and session variables (via URL Rewriting).
This programming API defines the expected interactions of a web container and a servlet. A web container is essentially the component of a web server that interacts with the servlets. The web container is responsible for mapping a URL to a particular servlet and ensuring that the URL requester has the correct access rights.
A servlet is an object that receives requests and generates a response based on the request. The API defines HTTP subclasses of the generic servlet requests and responses as well as an HTTP session object that tracks multiple requests and responses between the web server and a client. Servlets may be packaged as a Web application.
Moreover, servlets can be generated automatically by Java Server Pages (JSP), or alternately by template engines such as WebMacro. Often servlets are used in conjunction with JSPs in a pattern called "Model 2", which is a flavor of the Model/View/Controller pattern.
Web Containers
Like the other Java APIs, different vendors provide their own implementation. Below is a list of some of the free and commercial web containers.
Non-commercial Web Containers
- Jetty Web Server
- Enhydra Web Server
- jo! Web Server
- Jakarta Tomcat is web container licensed under the Apache Software License. It is used in the official reference implementation.
Commercial Web Containers
- Caucho's Resin Server
- BEA Weblogic Server or Weblogic Express
- Borland's Enterprise Server
- Oracle Application Server
- IBM's Web Sphere
- Sun/Netscape iPlanet Webserver
Commercial Open Source Containers
External links
- Sun's tutorial http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets.html
- Sun's product description http://java.sun.com/products/servlet
- Java Documentation of the API may be found at http://java.sun.com/products/servlet/2.3/javadoc/index.html
- Javapedia\n