JSP Servlet Interview Questions For Freshers Series 1
We know that while preparing for an interview there are lots of things needs to keep in your mind, and for freshers not easy to cover all the questions of Core Java, Servlet, JSP, Database, Aptitude, Algorithm etc. So we have planned to design few very popular interview question askeds in an interview for freshers on different series based on there priority and of course priority start from series 1. In our previous post we have listed very popular 20 Core Java basic interview questions for freshers. Friends don't worry we will post maximum number of interview questions on JSP Servlet but, started from very popular and most respective questions.
Yes, this is very popular interview question and interviewer expect from you to at least list down the process involved while serving request for a Servlet. Well, Servlet life cycle is managed by Servlet Container and javax.servlet.Servlet interface defines three methods as a life cycle method of Servlet and those are listed below.
2. What is a deployment descriptor?
Well, Deployment descriptor is an entry point for any web application, and it refers to a configuration file for the web application. Which is also known as web.xml, it's all about how components of your web application to be deployed on your server/engine. The web.xml file must be placed inside WEB-INF subdirectory at the web application root. In web.xml we will map URLs to our Servlets.
3. What is the <load-on-startup>
The <load-on-startup> tag is optional tag in web.xml file. The tag is define inside Servlet tag only. The optional content of this element must be a positive integer indicating the order in which the Servlet should be loaded. Priorities start from lower integer, lower integers are loaded before higher integers for example if you pass values as 1,2,3.. in respective Servlets. Server will starts initialization of Servlet from 1,2,3.. If no value is specified, or if the value specified is not a positive integer, then Server can load the Servlet in any order during application startup. For more on load on startup with example
4. What is JSESSIONID and when it gets created?
We all know that HTTP is stateless protocol and it does not maintain the state of previous request. Means our server/container will not maintain the conversational states between requests. That's why few session management mechanisms are used like Cookies, HTTPSession etc.
JSESSIONID is one of them, I mean JSESSIONID is a cookies generated by our underlying server/container and used for session management in web application.
JSESSIONID is created when server/container first time received a request for accessing a web application. By default cookie used as session management. Here is an example of URL appending with JSESSIONID "https://mybank.com/corp/HomeController;jsessionid=00004VhLTrSQ-IIp8FnwlKA_LmT".
5. Can you list down the implicit Objects of JSP? Or What are the implicit Objects in JSP?
Yes, Interviewer wants you to list down all implicit object of JSP, and those are listed below.
6. Is it possible to use constructor, instead of init() method? Yes/No
Of course Yes.
7. What is the difference between URL encoding and URL rewriting?
Well both URL encoding and URL rewriting is totally different to each other there is no any similarities between them, URL rewriting is one of the way of managing the session in web application whereas URL encoding is a concept to replace some character of URL string with some special characters like %5000Bro%.
8. How to call one Servlet from another Servlet
You can call one Servlet from another Servlet using forward method of RequestDispatcher, below is the syntax of calling another Servlet.
Well four different mechanisms to maintain Session in Servlet and those are listed below.
Of course three,
We have end here JSP Servlet Interview Questions For Freshers Series 1, here is our next series JSP Servlet Interview Questions For Freshers Series 2.
Friends you can also share your interview experience or improved answer of the questions with us, we will post your questions/answer on our interview question list.
JSP Servlet Interview Questions For Freshers Series 1
1. What is the life cycle of Servlet?Yes, this is very popular interview question and interviewer expect from you to at least list down the process involved while serving request for a Servlet. Well, Servlet life cycle is managed by Servlet Container and javax.servlet.Servlet interface defines three methods as a life cycle method of Servlet and those are listed below.
- void init(ServletConfig config)
- void service(ServletRequest req, ServletResponse res)
- void destroy()
- Loading Servlet Class
- Creating an Instance of Servlet
- Calling the Servlet's init() method
- Calling the Servlet's service() method
- Calling the Servlet's destroy() method.
2. What is a deployment descriptor?
Well, Deployment descriptor is an entry point for any web application, and it refers to a configuration file for the web application. Which is also known as web.xml, it's all about how components of your web application to be deployed on your server/engine. The web.xml file must be placed inside WEB-INF subdirectory at the web application root. In web.xml we will map URLs to our Servlets.
3. What is the <load-on-startup>
The <load-on-startup> tag is optional tag in web.xml file. The tag is define inside Servlet tag only. The optional content of this element must be a positive integer indicating the order in which the Servlet should be loaded. Priorities start from lower integer, lower integers are loaded before higher integers for example if you pass values as 1,2,3.. in respective Servlets. Server will starts initialization of Servlet from 1,2,3.. If no value is specified, or if the value specified is not a positive integer, then Server can load the Servlet in any order during application startup. For more on load on startup with example
4. What is JSESSIONID and when it gets created?
We all know that HTTP is stateless protocol and it does not maintain the state of previous request. Means our server/container will not maintain the conversational states between requests. That's why few session management mechanisms are used like Cookies, HTTPSession etc.
JSESSIONID is one of them, I mean JSESSIONID is a cookies generated by our underlying server/container and used for session management in web application.
JSESSIONID is created when server/container first time received a request for accessing a web application. By default cookie used as session management. Here is an example of URL appending with JSESSIONID "https://mybank.com/corp/HomeController;jsessionid=00004VhLTrSQ-IIp8FnwlKA_LmT".
5. Can you list down the implicit Objects of JSP? Or What are the implicit Objects in JSP?
Yes, Interviewer wants you to list down all implicit object of JSP, and those are listed below.
- out
- request
- response
- session
- application
- config
- page
- pageContext
- exception
6. Is it possible to use constructor, instead of init() method? Yes/No
Of course Yes.
7. What is the difference between URL encoding and URL rewriting?
Well both URL encoding and URL rewriting is totally different to each other there is no any similarities between them, URL rewriting is one of the way of managing the session in web application whereas URL encoding is a concept to replace some character of URL string with some special characters like %5000Bro%.
8. How to call one Servlet from another Servlet
You can call one Servlet from another Servlet using forward method of RequestDispatcher, below is the syntax of calling another Servlet.
RequestDispatcher rd = request.getRequestDispatcher("anotherServlet");
rd.forward(request,response);
9. What are the different mechanisms to maintain Session in ServletWell four different mechanisms to maintain Session in Servlet and those are listed below.
- Cookie
- URL Rewriting
- HTTPSession
- Hidden Form Field
Of course three,
- @page
- @include
- @taglib
We have end here JSP Servlet Interview Questions For Freshers Series 1, here is our next series JSP Servlet Interview Questions For Freshers Series 2.
Friends you can also share your interview experience or improved answer of the questions with us, we will post your questions/answer on our interview question list.

Very good post. its very beneficial to All. Need a latest Job opening updates. Visit Here :)
ReplyDeleteThank U for this nice blog, It's very beneficial for Freshers. Find More Job Vacancies here - Visit Here :)
ReplyDeleteExcellent post!!! Your article helped to under the future of java development. Being an open source platform, java is integrated in most of the software development industries to create rich featured applications. Java Training in Chennai
ReplyDeleteExcellent blogs.We have to learning that the lot new information.I will be like this information.
ReplyDeleteInformatica Training in Chennai
Thanks Vignesh, Keep visiting definitely you will find something new.
Deleteawesome interview question . it is very full my interview times . thanks to sharing Selenium Training in Chennai || Web Designing Training in Chennai
ReplyDeleteLearned something new . i am a newbie hope it will work for me! thanks..
ReplyDeleteCloud Computing Training in Chennai || ios Training in Chennai
This tutorial post highlights the important difference between JSP and Servlet technologies. ... Show Navigation Hide Navigation ... Servlet and JSP are the two key Java server side technologies that are building blocks for ... please send a mail to krishnas at javabeat.net...
ReplyDeleteWeb Designing Course in Chennai
What are different types of comments in JSP? ..... a collection or escape HTML tags to show them like text in response. Vmware Training in Chennai
ReplyDeleteThank you for this list, I found a lot of interesting things. I also learn some advance about iOS
ReplyDeleteiOS Training in Chennai
Thanks for sharing this blog with us.
ReplyDeleteCloud Computing Training in Chennai
Really an awesome post. I wondered by reading this blog post. Thanks a lot for posting this unique post which you have shared with us. Keep on posting like this exclusive post with us.Python Training institute in Chennai |
ReplyDeleteHi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging.
ReplyDeletesap training in chennai
sap training in tambaram
azure training in chennai
azure training in tambaram
cyber security course in chennai
cyber security course in tambaram
ethical hacking course in chennai
ethical hacking course in tambaram
This is the information that ive been looking for. Great insights & you have explained it really well. Thank you & looking forward for more of such valuable updates.
ReplyDeleteangular js training in chennai
angular js training in velachery
full stack training in chennai
full stack training in velachery
php training in chennai
php training in velachery
photoshop training in chennai
photoshop training in velachery
I am really happy with your blog because your article is very unique and powerful for new reader.
ReplyDeleteangular js training in chennai
angular js training in annanagar
full stack training in chennai
full stack training in annanagar
php training in chennai
php training in annanagar
photoshop training in chennai
photoshop training in annanagar
Very Good
ReplyDeleteThis blog is interested
https://www.digisnare.com/
This is a really helpful collection of JSP and Servlet interview questions. It’s great for beginners who want to understand core concepts like the JSP lifecycle, implicit objects, and the difference between JSP and Servlets. These topics are often asked in Java developer interviews and having clear fundamentals makes a big difference. Structured training and hands-on practice can also help learners strengthen these concepts further through real-world projects like those offered in Full Stack Development and Data Science programs.
ReplyDeleteThis article compiles practical JSP and Servlet interview questions and answers to help Java developers prepare for job interviews. It covers core topics like JSP/Servlet basics, lifecycle methods, differences between JSP and Servlets, and common scenarios you might face in an interview. A useful quick‑reference for brushing up on key web development concepts in Java.
ReplyDeleteIT Jobs Without Coding – Complete Beginner Guide
Very clear explanations here.
ReplyDeleteEasy to understand concepts.
UI/UX Design Resources UI/UX Courses in Chennai
Easy to understand concepts.
ReplyDeleteWell written and organized.
How to you become a data analyst