Java Server pages (JSP)


JSP is a simple sort of text document that contins two types of text:
1. static text: that can be expressed in any text-based format such as HTML, XML etc.
2. dynamic text: which contains dynamic data.

So, it is basically a technology that helps to create dynamically generated web pages based on HTML, XML, or other document types. It was released in 1999 by Sun Microsystems, JSP is a bit similar to PHP, but it uses the Java programming language.

To deploy and run JSP, a compatible web server with a servlet container, such as Apache Tomcat or Jetty, is required. The recommended file extension for the source file of a JSP page is .jsp.

JSP allows to mix static HTML with dynamically generated HTML- in the way that the business logic and the presentation are well separated.

 JSP technology creates web application just like Servlet technology. It can be thought of as an extension to servlet because it provides more fuctionality than servlet such as expression language, jstl etc.

 A JSP page consists of HTML tags and JSP tags. The JSP elements in a JSP page can be expressed in two syntaxes, standard and XML, though any given file can use only one syntax. A JSP page in XML syntax is an XML document and can be manipulated by tools and APIs for XML documents.

 JSP can be used to generate web forms which give outputs based on users input. To bridge the gap between JSP and HTML in JSP, additional features such as JSP Tags, Expression Language, Custom tags etc are used.

It is often quoted that can be done using servlet can accomplished using JSP. But one should note that these two technologies are complementary to each other and NOT replacement of each other.

In a typical Model-View-Cintrol (MVC) application, servlets are often used for the Contoller (C), which involves complex programming logic. JSPs are often used for the View (V), which mainly deals with the presentation. The Model (M) is usually implemented using JavaBean or EJB.

 Thus, Java Server Pages can be used for a variety of purposes, such as retrieving information from a database or registering user preferences, accessing Java Beans components, passing control between the pages and sharing information between requests, pages etc.