theres a lot of action going on with java servlets. the recent public release of java servlet specification v2.2 by sun microsystems enhances the functionality of the programming model and the deployment and runtime infrastructure of servlets, which provides for better packaging, security, distribution and management of servlet-based web applications. the servlet technology is now a part of the java 2 enterprise edition (j2ee) architecture and is expected to play an important role in the web/enterprise application server market that has hitherto been dominated by proprietary programming models.
when java servlets were introduced by sun in early 1997, the primary goal was to provide a java language alternative to the cgi (common gateway interface) model. accordingly, the initial model was designed to serve dynamic content for incoming http requests. those who followed servlets from their inception will remember their early description as applets on the server side. such descriptions were perhaps appropriate with the initial servlet model. over the past two years, however, sun has revised the specification significantly to let servlets cater to developing production-quality web applications. most of the development, deployment and runtime features of the servlet model have changed considerably over several revisions. servlets have now passed their infancy, and are beginning to be used for developing mission-critical web applications with commercial application servers such as websphere, netscape application server, netdynamics, weblogic and orion.
so where do servlets stand today?
servlet programming model - overview
java servlets are small, server-side programs that can be composed into dynamic web applications. servlets arent user-invokable applications, but are hosted on servlet containers (more about them later).servlet containers operate in tandem with web servers, and invoke servlets based on requests from these servers. when deploying servlets onto servlet containers, you can also specify canonical names to them. the servlet container maintains the mapping between these canonical names and servlet classes.
the servlet programming model is lightweight. its core classes are httpservlet, httpservletrequest, httpservletresponse, httpsession, servletcontext and servletconfig. of these, the httpservlet is the class that your application servlets extend from; the rest are interfaces. container vendors provide implementations for all these classes/interfaces.
servlet programming consists of overriding the init(), service() (or one of its derivatives to process get, post, head, delete, options, put and trace requests) and destroy() methods of the httpservlet class. refer t... 下一页