Java Programming Techniques and APIs

Java Server Page: Introduction

Java Server Page: Introduction


JavaServer Pages (JSP) is a server-side scripting language for creating web pages dynamically. It is a Java technology that is used to create web content dynamically in response to the client request. It was developed by Sun Microsystems and released in 1999.


The following are some of the benefits of using JSP:

  • Easy to use
  • Powerful
  • Supports HTML tags
  • Supports server side scripting
  • Supports XML tags

JSP is a JavaServer Pages (JSP) server technology. JSP pages can be incorporated into a web page like HTML, and JSP pages are written in the server’s native code. Unlike HTML, you do not need a separate browser to view a client-side JSP document like the Web browser or even an intranet administration application. You can embed your entire application inside the server. JSP is a Java Server Page (JSP) interpreter. It runs JavaScript statements inside JSP templates with Apache Tomcat, which converts the JavaScript into static Web content that is then rendered to the user’s browser. JSPs are compiled into servlets, which are Java classes that can be executed by a Java Virtual Machine. The JSP compiler translates JSP source files into servlet class files, which can be executed by any servlet container or Java EE application server.

JSP is a markup language for creating dynamic, interactive Web pages. JSP code can contain HTML markup and other special tags, but it was developed to give the programmer precise control over all aspects of the rendering of the document, including how to display images, text content plus direct manipulation of an HTTP Request. As such, JSP offers many benefits over traditional HTML pages. For example, when compared with regular HTML pages, JSP offers less overhead in terms of parsing and execution times (therefore faster response times) as well as better performance (depending on application requirements).

The following features of JSPs make it an attractive choice for web developers:

  • It provides the ability to generate dynamic content for the browser without having to write code in JavaScript or other client-side scripting languages
  • It provides the ability to use HTML tags in addition to standard text and scriptlets
  • It provides a way for programmers to include expressions in their code without having to resort to using string concatenation The advantages of JSPs are:
  • It is easy to learn and use.
  • JSPs can be used with any other Java technology such as servlets, Enterprise Java Beans (EJB), and Web Services (SOAP).
  • JSPs provide a platform independent way to create dynamic content for the web.


Tag Declaration:

<%!  Dec var  %> 

Java Scriplets:

<% java code %> 

JSP Expression:

<%= expression %> 


<title>welcome to BI</title>
    <%= "Hello World!" %>


JSP is a Java Server Page. A JSP page is HTML coded and served as a set of dynamic HTML pages in response to requests. JSP runs in the server and thus is not dependent on the browser displaying it; this makes it possible for you to control access to your application from different browsers—all without changing your code.