Servelets
Why do we need a constructor in a servlet if we use the init method?
Nov 26th
Even though there is an init method in a servlet which gets called to initialize it, a constructor is still required to instantiate the servlet. Even though you as the developer would never need to explicitly call the servlet’s constructor, it is still being used by the container (the container still uses the constructor to create an instance of the servlet). Just like a normal POJO (plain old java object) that might have an init method, it is no use calling the init method if you haven’t constructed an object to call it on yet.
What are the new features added to Servlet 2.5?
Nov 26th
Following are the changes introduced in Servlet 2.5: • A new dependency on J2SE 5.0 • Support for annotations • Loading the class • Several web.xml conveniences • A handful of removed restrictions • Some edge case clarifications
What are the uses of Servlet?
Nov 26th
Typical uses for HTTP Servlets include: • Processing and/or storing data submitted by an HTML form. • Providing dynamic content, e.g. returning the results of a database query to the client. • A Servlet can handle multiple request concurrently and be used to develop high performance system • Managing state information on top of the stateless HTTP, e.g. for an online shopping cart system which manages shopping carts for many concurrent customers and maps every request to the right customer.
What is the Servlet?
Nov 26th
A servlet is a Java programming language class that is used to extend the capabilities of servers that host applications accessed by means of a request- response programming model.
