Advantage of JSP over Servlet

Java Server Pages (JSP) for short is Sun's answer for creating dynamic sites. JSP give magnificent server side scripting support for making database driven web applications. JSP empower the engineers to straightforwardly embed java code into jsp document, this makes the improvement handle exceptionally basic and its upkeep likewise turns out to be simple. JSP pages are proficient, it loads into the web servers memory on accepting the solicitation first time and the resulting calls are served inside of a brief timeframe.

In today's environment most web sites servers dynamic pages in light of client solicitation. Database is extremely advantageous approach to store the information of clients and different things. JDBC give astounding database network in heterogeneous database environment. Utilizing JSP and JDBC its simple to create database driven web application. Java is known for its normal for "compose once, run anyplace." JSP pages are stage free. Your port your .jsp pages to any stage.

Why Use JSP

JavaServer Pages often serve the same purpose as programs implemented using the Common Gateway Interface (CGI). But JSP offer several advantages in comparison with the CGI.

  1. Execution is altogether better in light of the fact that JSP permits implanting Dynamic Elements in HTML Pages itself as opposed to having a different CGI documents.
  2. JSP are constantly ordered before it's prepared by the server not at all like CGI/Perl which requires the server to stack a mediator and the objective script every time the page is asked.
  3. JavaServer Pages are based on top of the Java Servlets API, so like Servlets, JSP likewise has entry to all the capable Enterprise Java APIs, including JDBC, JNDI, EJB, JAXP and so forth.
  4. JSP pages can be utilized as a part of blend with servlets that handle the business rationale, the model bolstered by Java servlet layout motors.
  5. At long last, JSP is an indispensable piece of Java EE, a complete stage for big business class applications. This implies JSP can have impact in the least difficult applications to the most perplexing and requesting.

Advantage of JSP:

  1. JSP are translated and compiled into JAVA servlets but are easier to develop than JAVA servlets.
  2. JSP have all advatages of Java i.e write once run anywhere
  3. JSP uses simplified scripting language based syntax for embedding HTML into JSP.
  4. JSP containers provide easy way for accessing standard objects and actions.
  5. JSP reaps all the benefits provided by JAVA servlets and web container environment, but they have an added advantage of being simpler and more natural program for web enabling enterprise developer
  6. JSP use HTTP as default request /response communication paradigm and thus make JSP ideal as Web Enabling Technology.


The JSP API consists of two packages:

  1. javax.servlet.jsp
  2. javax.servlet.jsp.tagext

javax.servlet.jsp package

The javax.servlet.jsp package has two interfaces and classes.The two interfaces are as follows:

  1. JspPage
  2. HttpJspPage

The classes are as follows:

  • JspWriter
  • PageContext
  • JspFactory
  • JspEngineInfo
  • JspException
  • JspError