Logo F2FInterview

Servlet Interview Questions

Q   |   QA

The servlet mapping defines an association between a URL pattern and a servlet. The mapping is used to map requests to Servlets.

Yes. But you will not get the servlet specific things from constructor. The original reason for init() was that old versions of Java couldn’t dynamically invoke constructors with arguments, so there was no way to give the constructor a ServletConfig. That no longer applies, but servlet containers still will only call your no-arg constructor. So you won’t have access to a ServletConfig or ServletContext.

Yes. But the container will always call the default constructor only. If default constructor is not present, the container will throw an exception.

ServletRequest and ServletResponse.

A servlet can handle multiple requests concurrently, and can synchronize requests. Servlets can forward requests to other servers and servlets. Thus servlets can be used to balance load among several servers

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: