Interview Questions and Answers on JSP
Here we are gonna to discuss some basic and important JSP interview questions and answers. JSP is the most important topic for advance java interviews.
So let's start frequently asked java jsp interview questions.
Servlet
So let's start frequently asked java jsp interview questions.
(1) What is JSP?
JSP is known as 'Java Server Pages'. JSP is a server-side programming language which is used to create dynamic web-pages just like servlet technology. We can use jsp for making web project. In other words, by using JSP technology we can create attractive websites.
(2) Is JSP extension of Servlet?
Yes, Jsp is an extension of servlet technology.
(3) JSP page internally converted into servlet, true of false?
Yes, It is 100% true. Jsp pages internally convert into servlet.
(4) What is life-cycle of jsp?
Jsp life-cycle given below.
- JSP page translation : Jsp page translate into servlet.
- JSP page compilation: After translated into servlet, servlet compilation will be performed.
- Classloading: By the help of classloader .class file of servlet will load.
- Instantiation of Servlet: Object of servlet will create.
- Initialization: Container will call jspInit() method only once in this phase.
- Request Processing : Container will call -jspService() method for each request.
- Destroy: In the last phase, Container will call jspDestroy() method.
(5) How many life-cycle methods are of jsp?
There are 3 life-cyle methods of jsp.
- jspInit() method.
- _jspService(ServletRequest req, ServletResponse res) method.
- jspDestroy() method.
(6) How many implicit objects in jsp?
there are 9 implicit objects in jsp which is given below.
- out
- request
- response
- session
- config
- page
- exception
- application
- pageContext
(7) How to dissable session in jsp?
We can dissable session in jsp by using <% @ page session = "false" %>.
(8) Define all scripting elements in jsp?
1) Scriptlet Tag
By using scriptlet tag we can easily execute java source code in jsp file.
Syntax :
<% java code %>
2) Expression Tag
By using expression tag we can easily get the value of any variables and methods.
Syntax :
<%= statement %>
3) Declaration Tag
Declaration tag is used to declare the variables and methods.
Syntax :
<%! declaration of variable and method %>
(9) Define all the directives in jsp?
There are 3 kinds of directives.
Jsp directive is responsible how to convert jsp page into servlet.
- Page Directive.
- Include Directive.
- Taglib Directive.
(10) How to declare jsp directive?
The syntax is used to declaring jsp directive,
<%@ directive attribute = "value" %>
for example : <%@ page import = "java.util.date" %>
(11) Write some attribute of jsp page directive.
There are some page directive attribute given below.
- import
- extends
- contentType
- pageEncoding
- errorPage
- isErrorPage
- session
- autoFlush
- buffer
- language
- info
- isThreadSafe
- isELIgnored
(12) How to insert a comment in jsp page?
We can insert comment in jsp page by using <% - jsp comment -%>.
(13) Difference between include directive and include action.
There are some differences between include directive and include action which is given below.
Include Directive
- Include directive is better for static pages.
- Include directive includes the original page of the content.
- At the page translation time, It includes the content.
Include Action
- Include directive is better for dynamic pages.
- Include directive does not include original content.
- At the time of a request, It includes the content.
(14) Is that mandatory to configure jsp file in web.xml file?
No, It is optional. We can run web application without configuration of jsp file in web.xml file.
(15) What is the difference between JSP and Servlet?
There are many differences between JSP and Servlet.
JSP(Java Server Pages)
- JSP is easy to learn.
- JSP provides some predefine tags such scriptlet tag, custom tag, expression tag, etc.
- There is no need to configuration of jsp file in web.xml file.
- Both presentation and business logic are separated in jsp.
- There is no need to recompile and redeploy of jsp file if we modify any jsp file.
- JSP provides certain implicit objects.
Servlet
- Servlet is not easy to learn.
- Servlet does not provide any tags.
- We have to configure servlet in web.xml file.
- Both presentation and business logic are not separated in servlet.
- If we modify and servlet then we have to recompile and redeploy the project.
- Servlet does not provide implicit objects.
(16) What is expression language?
Expression language provides simple and easy to access the data from implicit objects and bean.
(17) What is JSTL?
JSTL stands for JSP standard tag library which is the collection of some useful core tags which make the software development easy and fast.
Visit : Servlet Interview questions and answers.
OOPS Interview questions and answers.
Java Multithreading Interview Questions.
Java Collection Interview Questions.
Struts Framework Interview Questions.
Top 10 Java Programming Interview Questions for Fresher.
I hope, this java jsp interview questions and answers will help you in java interviews.
Visit : Servlet Interview questions and answers.
OOPS Interview questions and answers.
Java Multithreading Interview Questions.
Java Collection Interview Questions.
Struts Framework Interview Questions.
Top 10 Java Programming Interview Questions for Fresher.
I hope, this java jsp interview questions and answers will help you in java interviews.
Provide tutorial jsp vs servlet in java .thanks for this tutorial
ReplyDeleteGreat Article android based projects
DeleteJava Training in Chennai
Project Center in Chennai
Java Training in Chennai
projects for cse
The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training
It has been great for me to read such great information a bout jsp-interview-questions thanks for posting java training
ReplyDeleteThank you for your informative blog java training in chennai
ReplyDeleteOur training will be focused on aiding placements too. We have separate HR team professionals who will take care of all your interview needs. Our Core Java Training in Gurgaon Course Fees is very moderate compared to others. We are the main Core Java training institute who can share video reviews of every one of our students.
ReplyDeleteFor More Info: Core Java Training in Gurgaon
I was more than happy to uncover this great site. I need to to thank you for your time due to this fantastic read!! I definitely enjoyed every bit of it and I have you bookmarked to see new information on your blog.
ReplyDeleteJava Training in Bangalore
The article is so appealing. You should read this article before choosing the Big data app development you want to learn.
ReplyDeleteSet aside my effort to peruse all the remarks, however I truly delighted in the article. It's consistently pleasant when you can not exclusively be educated, yet in addition, engaged!
ReplyDeletebig data course
Very well written blog this blog has excellent knowledgable content and has been immensely helpful and understanding various concepts and theory
ReplyDeletejava Training Hyderabad
I think I have never watched such online diaries ever that has absolute things with all nuances which I need. So thoughtfully update this ever for us.
ReplyDeletedifference between analysis and analytics
If you don't mind, then continue this excellent work and expect more from your great blog posts
ReplyDeleteiot training in delhi
ReplyDeleteI need to communicate my deference of your composing aptitude and capacity to make perusers read from the earliest starting point as far as possible. I might want to peruse more up to date presents and on share my musings with you.
https://360digitmg.com/course/artificial-intelligence-ai-and-deep-learning
I see some amazingly important and kept up to length of your strength searching for in your on the site
ReplyDeletebusiness analytics course
Thanks, this is generally helpful.
ReplyDeleteStill, I followed step-by-step your method in this Java online training
Java online course
This information is impressive; I am inspired how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic snowflake data warehouse
ReplyDeleteEfendim sitemiz üzerinden eft/havale ile işlem gerçekleştirebilirsiniz ,
ReplyDeleteEft/havale ile ödeme işleminden sonra Ödeme bildirimi Formu gözükmektedir doğru şekilde doldurup gönderebilirsiniz aksi halde sipariş / ödemeniz tarafımıza ulaşmayacak ve onay almıyacaktır.
This post is very simple to read and appreciate without leaving any details out. Great work!
ReplyDeletedata analytics training aurangabad
Good content. You write beautiful things.
ReplyDeletemrbahis
korsan taksi
hacklink
taksi
vbet
sportsbet
vbet
mrbahis
hacklink
will omit your great writing due to this problem.
ReplyDeleteselenium testing course online
best selenium course online