Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Advantage of using Servlet over CGI

Answer»

Advantage of using Servlet over CGI
Below are the 4 main features that make Servlet very powerful then CGI
(1)Servlet is much much better performer then CGI when we say about processing TIME and memory utilization. This is because servlets use benefits of multi-threading and for each of request a new thread is created which is far far better then in CGI a new object is created for each request with CGI.
(2)Servlet have another very good features that Servlet web application can be run on any standard web container like Tomcat, JBOSS, Glassfish server or we have any operating system like Windows, Linux, Unix, Solaris, Mac etc.
(3)In Servlet we will not worry about memory LEAKS, security and garbage collection because Servlets are robust because container take care of life cycle of servlets.
(4)Servlets are maintainable and the learning curve is small because all we need to take care is business logic for our application.

2.

What is Servlet Filter and its usage

Answer»

What is Servlet Filter and its usage
As we know filter is an object that is usally happened at the time of pre and post processing of request. And there are many task which are performed by filter such as logging, compression, encryption, CONVERSION and decryption and input validation etc.
The servlet filter is pluggable and usaully we will defined entry in web.xml files. If we remove that entry then filter will automatically removed and we DONOT need to change the servlet.
Usage of Filter
(1)It will records all INCOMING requests
(2)Will HELPS in conversion
(3)It will logs the IP Addresses of computers which make the requests
(4)It helps in data compression
(5)It helps in encryption and decryption
(6)Its helps in validation of user input

3.

Simplest definition of Servlets or what is Servlets

Answer»

Simplest definition of SERVLETS or what is Servlets
To create dynamic web page which is placed on server side we USE Servlet technology or we can say to create web application we use Servlets. Because of Java language Servlet technology is robust and Scalable. Servlets comes after the CGI scripting langauge which is a very common server-side PROGRAMMING language. Below are the most common classes and interfaces in Servlet API
(1)GENERICSERVLET
(2)HttpServlet
(3)ServletRequest
(4)ServletResponse
We can also say that Servlet is a class that extends the capabilities of servers and responds to the INCOMING requests. It can resond to any requests. We can also say that Servlet is a web component that is deployed on the server to create a dynamic web page.

4.

Different methods of session management in servlets?

Answer»

Different methods of session MANAGEMENT in servlets?
Session is conversational STATE between client SERVER approach which consists of MULTIPLE request and response between client and server. As we know HTTP and Web Server both are stateless, usually We maintain a session when some unique information about the session is transfer between server and client in EVERY request and response.

Below are the list of session management in servlets are:
(1)User Authentication
(2)HTML Hidden Field
(3)Cookies
(4)URL Rewriting
(5)Session Management API



Servlets Session