Here is what users have to say about Servlet
Entry added by CWAnswers Join us and contribute your knowledge as well.
Select content modules
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 non-Java dynamic Web content technologies such as PHP, CGI and ASP.NET. Servlets can maintain state across many server transactions by using HTTP cookies, session variables or URL rewriting.
Help us make CWAnswers better. Be the first one to edit this topic!
Weblinks for servlet
Top 10 for servlet
Things about servlet you find nowhere else.
Comments about this page
Wikipedia about servlet
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 non-Java dynamic Web content technologies such as PHP, CGI and ASP.NET. Servlets can maintain state across many server transactions by using HTTP cookies, session variables or URL rewriting.
The Servlet API, contained in the Java package hierarchy , 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 managing the lifecycle of servlets, mapping a URL to a particular servlet and ensuring that the URL requester has the correct access rights.
A is an object that receives a request and generates a response based on that request. The basic servlet package defines Java objects to represent servlet requests and responses, as well as objects to reflect the servlet's configuration parameters and execution environment. The package defines HTTP-specific subclasses of the generic servlet elements, including session management objects that track multiple requests and responses between the Web server and a client. Servlets may be packaged in a WAR file as a Web application.
Servlets can be generated automatically by JavaServer Pages (JSP) compiler, 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.
History
The complete servlet specification was created by Sun Microsystems, with version 1.0 finalized in June 1997. Starting with version 2.3, the servlet specification was developed under the Java Community Process. JSR 53 defined both the Servlet 2.3 and JavaServer Page 1.2 specifications. JSR 154 specifies the Servlet 2.4 and 2.5 specifications. As of May 10, 2006, the current version of the servlet specification is 2.5.
In his blog on java.net, Sun veteran and GlassFish lead Jim Driscoll details the history of servlet technology. 1 James Gosling first thought of servlets in the early days of Java, but the concept did not become a product until Sun shipped the Java Web Server product. This was before what is now the Java Platform, Enterprise Edition was made into a specification.
Lifecycle of a Servlet
The Servlet lifecycle consists of the following steps:
- The Servlet class is loaded by the container during start-up.
- The container calls the
init()method. This method initializes the servlet and must be called before the servlet can service any requests. In the entire life of a servlet, theinit()method is called only once. - After initialization, the servlet can service client-requests. Each request is serviced in its own separate thread. The container calls the
service()method of the servlet for every request. Theservice()method determines the kind of request being made and dispatches it to an appropriate method to handle the request. The developer of the servlet must provide an implementation for these methods. If a request for a method that is not implemented by the servlet is made, the method of the parent class is called, typically resulting in an error being returned to the requester. - Finally, the container calls the
destroy()method which takes the servlet out of service. Thedestroy()method likeinit()is called only once in the lifecycle of a Servlet.
























Mr Wong


Show/Hide