Skip to content
  • Facebook
GeekCer Logo

GeekCer

The geek's Coding education and Review centre

  • Home
  • Tutorials
    • Java
    • Servlet
    • JSP
    • Python
    • C Tutorial
    • Spring
    • Spring Boot
    • MongoDB
    • Hibernate
    • Data Structure
  • General Knowledge
  • Biography
  • Grammar
  • Festival (त्योहार)
  • Interview
  • Differences
  • Important
  • Toggle search form

Home » JSP » Java Server Pages (JSP)

  • Kishkindha Kand in Hindi | Ram meets Hanuman | किष्किंधा कांड
    Kishkindha Kand in Hindi | Ram meets Hanuman | किष्किंधा कांड Spiritual
  • What is Adjective in Hindi (विशेषण क्या है?)
    What is Adjective in Hindi (विशेषण क्या है?) Grammar
  • Ganesh Chaturthi Puja in Hindi | गणेश चतुर्थी का व्रत, महत्व, कथा
    Ganesh Chaturthi Puja in Hindi | गणेश चतुर्थी का व्रत, महत्व, कथा Festival
  • Balkand Ramayana story in Hindi | रामायण बाल कांड राम का जन्म
    Balkand Ramayana story in Hindi | रामायण बाल कांड राम का जन्म Spiritual
  • Jhansi Ki Rani Lakshmi Bai History, Story, Information in Hindi
    Jhansi Ki Rani Lakshmi Bai History, Story, Information in Hindi Biography
  • Aranya Kand with Hindi Meaning | अरण्यकाण्ड | सीता हरण
    Aranya Kand with Hindi Meaning | अरण्यकाण्ड का अर्थ | सीता हरण Spiritual
  • Human rights day
    Human rights day in Hindi: 10 दिसंबर ह्यूमन राइट्स डे General Knowledge
  • Kapil Sharma Show, Comedy Show in Hindi
    Kapil Sharma Show, Comedy Show in Hindi Biography

Java Server Pages (JSP)

Posted on August 31, 2021October 20, 2021 By GeekCer Education No Comments on Java Server Pages (JSP)
Java Server Pages (JSP)

Java Server Pages (JSP) enables us to create a dynamic and platform independent method for building web based applications. JSP is a server-side programming technology and is an extension of Servlet.

It separates the view from the application logic and promotes a reusable-component model of programming.

The main purpose of JSP is to reduce the Java code in web applications as much as possible.

We can use JSP to design web application and it acts as a view part in MVC framework like Spring, and it shows the data on web browser.

Table of Contents

  • Advantages of JSP
  • Lifecycle of Java Server Pages (JSP)
  • Difference between JSP and Servlet in Java
  • Difference between HTML and JSP(Java Server Pages)

Advantages of JSP

There are following advantages of JSP

  • It is an extension of Servlet so it has more feature than servlet.
  • It is easy to do web design using JSP because it does not require much knowledge about Java.
  • We can generate dynamic contents by using JSP.
  • If you do some modification in JSP page then you do not need to compile every time hence development is fast.
  • Maintenance is easy as we need to do minimum code as compared to Servlet

Lifecycle of Java Server Pages (JSP)

When you send request from client/web browser for JSP page then JSP container picks up the request, identifies the JSP page and performs life cycle actions.

  • JSP Translation
  • JSP Compilation
  • Class Loading (The class loader loads class file)
  • Instantiation (Object of generated servlet is created)
  • Initialization (jspInit() invocation)
  • Request Processing (_jspService() invocation)
  • Destroy (jspDestroy() invocation)

Difference between JSP and Servlet in Java

As you can use both JSP and Servlet in web application but there are many differences between them which are as follows:

#JSPServlet
1JSP is a webpage scripting language.Servlets are Java programs that are already compiled.
2JSP is slower than Servlets because it passes through JSP life-cycle.As servlet has a short response time so servlet is faster than JSP.
3JSPs are easier to code, as here Java is coded in HTML.Servlets are harder to code, as here we write HTML codes in Java.
4JSP only accept HTTP requests.Servlet can accept all protocol requests.
5You can not override service() method in JSP.But you can override service() method in Servlets.
6Session management in JSP is automatically enabled.But in Servlet, you have to enable it explicitly.
7In JSP, you can import packages anywhere in the file.But in servlets, you need to import all the packages at the top of the Servlets.
8Easy and faster modifications in JSPs because you just need to refresh the pages.But you need to reload, recompile, and then restart the servers hence modifications are time-consuming and challenging task.
9JSP is used for presentation purpose.But servlet is used for business processing.
JSP Vs Servlet

Difference between HTML and JSP(Java Server Pages)

You can use both JSP and HTML to build web applications. Both are scripting languages, JSP is a server-side scripting language while HTML is a client-side scripting language.

#JSPHTML
1JSP is a server side programming technology.HTML is a client side scripting language.
2We use JSP to generate dynamic web page.But we use HTML to generate static web page.
3JSP is given by Sun Micro System.HTML was created by Tim Berners-Lee.
4Need JSP container to execute JSP code.But you need HTML Interpreter to execute html code.
5JSP is slower to load as it runs on server (Apache tomcat, glassfish).HTML is fast as it runs on client (browser).
6A JSP page may consist of HTML tags and JSP tags. But HTML can only have html tags.
7It allows to place custom tag or third party tag.But it does not allow to place custom tag or third party tag.
JSP Vs HTML

Finally, you got the basic knowledge about JSP and lifecycle of JSP and most importantly using this article you have learned difference between JSP and Servlet in Java.

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • More
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Also Read

JSP Tags:HTML Vs JSP, JSP Vs Servlet, Life Cycle, Platform Independent, Web Application

Post navigation

Next Post: JSP Scripting Tags (Scripting Elements)

More Related Articles

HTTP status codes List | Response Status Code Glossary HTTP status codes List | Response Status Code Glossary Important
JSP Implicit Objects JSP Implicit Objects JSP
JSP Directives JSP Directives JSP
JSP Scripting Tags (Scripting Elements) JSP Scripting Tags (Scripting Elements) JSP

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • JSP Home
  • JSP Scripting Tags
  • JSP Directives
  • JSP Implicit Objects
  • National Farmers Day in Hindi | राष्ट्रीय किसान दिवस पर निबंध | चौधरी चरण सिंह जयंती
  • Human rights day in Hindi: 10 दिसंबर ह्यूमन राइट्स डे
  • Unicef day is celebrated on December 11 | Speech on unicef day
  • Indian Navy Day: जल सेना दिवस कब और क्यों मनाया जाता है?
  • P V Sindhu Biography in Hindi, Badminton, State, Caste पी. वी. सिंधु जीवन परिचय, कहानी, राज्य, जाति
  • Draupadi Murmu Biography In Hindi | द्रौपदी मुर्मू की जीवनी
  • TCP/IP Model, Full Form, Layers and their Functions
    TCP/IP Model, Full Form, Layers and their Functions Networking
  • Difference between Internet and Intranet
    Difference between Internet and Intranet Differences
  • OSI Model | 7 Layers of OSI Model in Computer network
    OSI Model | 7 Layers of OSI Model in Computer network, Functions Networking
  • Difference between TCP and UDP
    Difference between TCP and UDP | TCP vs UDP examples Differences
  • Similarities and difference between OSI and TCP/IP model
    OSI vs TCP/IP Model, Similarities and difference between OSI and TCP/IP model Networking
  • IPv4 Vs IPv6 | Difference between IPv4 and IPv6
    IPv4 Vs IPv6 | Difference between IPv4 and IPv6 Differences
  • Network kya hai (नेटवर्क क्या है)
    Network kya hai (नेटवर्क क्या है) Networking
  • Java Tutorial
  • Servlet Tutorial
  • JSP Tutorial
  • Maven Tutorial
  • HTML Tutorial
  • Programs
  • Hindi/English Grammar
  • Difference Between ... and ...
  • HR Interview
  • Important Articles

Write to Us:
geekcer.code@gmail.com

  • About Us
  • Privacy and Policy
  • Disclaimer
  • Contact Us
  • Sitemap

Copyright © GeekCer 2022 All Rights reserved