Java Server Pages - Introduction

October 2016

JSP (Java Server Pages) is a standard for developing interactive Web applications (pages containing dynamic content). A JSP web page (recognizable by the .jsp extension) may display different content based on certain parameters (information stored in a database, the user preferences, ..), while a classic webpage (with the .htm or .html extension) will continuously display the same information.
  • JSP is actually a powerful scripting language (interpreted language) executed on the server side (like CGI, PHP, ASP, ...) and not on the client side (unlike scripts written in JavaScript or Java applets which run in the browser of the user connected to a site).
  • JSPs are integrated in a web page in HTML using special tags which will notify the Web server that the code included within these tags are to be interpreted. The result (HTML codes) will be returned to the client browser .
  • Java Server Pages are part of a 3-tier architecture: where a server supporting the Java Server Pages (generally referred to as application server) will act as a mediatior between the client browser and a database (generally referred to as data server). JSP provides the necessary elements for the connection to the database management system and allow the manipulation of data through SQL.

How Java Server Pages works?

A page using Java Server Pages is executed during the query, by a JSP engine (generally running with a Web server or an application server). The JSP model is derived from the one used for Java servlets (JSP are indeed a way to write servlets). It is a Java class derived from HttpServlet class, making use of using doGet() and doPost() to return an HTTP response.

When a user calls a JSP page, the Web server calls the JSP engine which creates a Java source code from the JSP script and compile the class to provide a compiled file (with the .class extension).

Note that: the JSP engine checks if the date of the .jsp file corresponds to the .class file. The JSP engine will convert and compile the class, only if the JSP script has been updated. Thus, the fact that the compilation only takes place when the JSP script is updated, makes JSP, one of the fastest technologies to create dynamic pages.

Characteristics of Java Server Pages

JSPs can be used to create servlets, by including specific tags in the JSP code. In this way, they provide a fast technology to create dynamic pages.

In addition, JSP has all the characteristics of Java:
  • JSPs are multithreaded.
  • JSPs are portable.
  • JSPs are object-oriented.
  • JSPs are secure.

Original document published on

Related :

This document entitled « Java Server Pages - Introduction » from CCM ( is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.