Let's learn java programming language with easy steps. This Java tutorial provides you complete knowledge about java technology.

Sunday, 11 March 2018

JSP Interview Questions and Answers

Interview Questions and Answers on JSP

JSP Interview Questions and Answers

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.


(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.

  1. jspInit() method.
  2. _jspService(ServletRequest  req, ServletResponse res) method.
  3. jspDestroy() method.

(6) How many implicit objects in jsp?

there are 9 implicit objects in jsp which is given below.

  1. out
  2. request
  3. response
  4. session
  5. config
  6. page
  7. exception
  8. application
  9. 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.

  1. Page Directive.
  2. Include Directive.
  3. 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.

Share:

19 comments:

  1. Provide tutorial jsp vs servlet in java .thanks for this tutorial

    ReplyDelete
    Replies
    1. Great Article android based projects

      Java 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

      Delete
  2. It has been great for me to read such great information a bout jsp-interview-questions thanks for posting java training

    ReplyDelete
  3. Our 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.
    For More Info: Core Java Training in Gurgaon

    ReplyDelete
  4. 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.
    Java Training in Bangalore

    ReplyDelete
  5. The article is so appealing. You should read this article before choosing the Big data app development you want to learn.

    ReplyDelete
  6. Set 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!
    big data course

    ReplyDelete
  7. Very well written blog this blog has excellent knowledgable content and has been immensely helpful and understanding various concepts and theory

    java Training Hyderabad

    ReplyDelete
  8. 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.
    difference between analysis and analytics

    ReplyDelete
  9. If you don't mind, then continue this excellent work and expect more from your great blog posts
    iot training in delhi

    ReplyDelete

  10. I 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

    ReplyDelete
  11. I see some amazingly important and kept up to length of your strength searching for in your on the site
    business analytics course

    ReplyDelete
  12. Thanks, this is generally helpful.
    Still, I followed step-by-step your method in this Java online training
    Java online course

    ReplyDelete
  13. 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

    ReplyDelete
  14. Efendim sitemiz üzerinden eft/havale ile işlem gerçekleştirebilirsiniz ,
    Eft/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.

    ReplyDelete
  15. This post is very simple to read and appreciate without leaving any details out. Great work!
    data analytics training aurangabad

    ReplyDelete

Facebook Page Likes

Follow javatutorial95 on twitter

Popular Posts

Translate