Servlet Questions

0
457

Servlet is at the heart of JEE. So one must be very clear with the concepts of Servlet. Without knowing servlet basics, it is highly difficult to understand any of the Java Frameworks as well. Once you start working on web, you need to know servlet.

Here is the complete list of Java Servlet Interview Questions:

[symple_highlight color=”gray”]Question 1: [/symple_highlight] Explain the life cycle of a servlet?

[symple_highlight color=”gray”]Question 2: [/symple_highlight] Who is responsible for executing service() method on request?

[symple_highlight color=”gray”]Question 3: [/symple_highlight] How a web server is different than a servlet container?

[symple_highlight color=”gray”]Question 4: [/symple_highlight] What is the difference between doGet(), doPost() ?

[symple_highlight color=”gray”]Question 5: [/symple_highlight] If all three methods doGet(), doPost() and service() are present in a servlet, what will happen and what would be the sequence of execution?

[symple_highlight color=”gray”]Question 6: [/symple_highlight] What is the difference between forward and sendRedirect ?

[symple_highlight color=”gray”]Question 7: [/symple_highlight] What are the different ways to maintain the session on server? How to set values on session?

[symple_highlight color=”gray”]Question 8: [/symple_highlight] How can we use cookies in servlet?

[symple_highlight color=”gray”]Question 9: [/symple_highlight] How to use HttpSession and why to use it?

[symple_highlight color=”gray”]Question 10: [/symple_highlight] How do you get the object of a session?

[symple_highlight color=”gray”]Question 11: [/symple_highlight] What’s the purpose of Servlet’s config and Servlet Context?

[symple_highlight color=”gray”]Question 12: [/symple_highlight] Why do we have init() method in a servlet?

[symple_highlight color=”gray”]Question 13: [/symple_highlight] How do we access initial parameters in Servlet and where do we declare them? What are the method names?

[symple_highlight color=”gray”]Question 14: [/symple_highlight] How to make servlets single threaded / thread safe?

[symple_highlight color=”gray”]Question 15: [/symple_highlight] What is servlet chaining?

[symple_highlight color=”gray”]Question 16: [/symple_highlight] What is RequestDispatcher in Servlet? Methods of RequestProcessor?

[symple_highlight color=”gray”]Question 17: [/symple_highlight] How do you redirect the request using RequestDispatcher?

[symple_highlight color=”gray”]Question 18: [/symple_highlight] If 100 requests are coming to the server, how they will be handled? Can we make any pool of servlet instances?

[symple_highlight color=”gray”]Question 19: [/symple_highlight] When does web.xml gets loaded into the memory?

Previous articleJava Serialization
Next articleJSP Questions
I have spent almost 10 years playing around Java and related technologies. I love to write on different topics and would be very much willing to hear back your feedback/suggestions on them. This site is a medium to share my knowledge with the Java folks and grow further. My other interests include traveling, driving, swimming and dance. But yes, my web site has become my passion over the time :) I live in Scotland and travel to India often, my roots being there.

NO COMMENTS

LEAVE A REPLY