
Introduction:
Java Server Pages - (JSP) is a Server-side technology to create dynamic web pages. The JSP is more like HTML only with a bit mix of java code in it. This is used for implementing the Presentation Layer which is the GUI part of an Application.
JSP's are a lot used in web applications. As this is a bit mix of HTML and Java code, it is easy to understand the language.
JSP's provides additions features to such as JSP tags, Expression Language, and Custom tags. This makes the developer to create web pages quickly.
JSP's Versions:
Sr.No. |
JSP Version |
Java Platform |
Released Year |
1 |
1.1 |
J2EE 1.2 |
Dec 12, 1999 |
2 |
1.2 |
J2EE 1.3 |
Sept 14, 2001 |
3 |
2.0 |
J2EE 1.4 |
Nov 11, 2003 |
4 |
2.1 |
Java EE 5 |
May 11, 2006 |
5. |
2.2 |
Java EE 6 |
Dec 10, 2009 |
6. |
2.3 |
Java EE 7 |
June 12, 2013 |
7. |
3.0 |
Java EE 8 |
August 31, 2017 |
If you are a beginner to JSP then check out below recommended topics...
JSP Comments:
Since JSP is built on top of HTML, we can write comments in JSP file like HTML comments as below shown:

These comments are sent to the client and we can look at it with the view-source option of browsers.
We can put comments in the JSP file as below:

This comment is suitable for developers to provide code-level comments because these are not sent in the client's response.
JSP Tags -
JSP tags are used to write Java Source code to implement business logic. Check out this post a more detailed explanation.
1. Scriptlet tag
2. Declaration tag
3. Expression tag
JSP directives -
JSP Directives are used to give special instruction to the container for translation of JSP to Servlet code, for a detailed explanation of JSP directives check out this article by clicking on it.
1. page directive
2. include directive
3. taglib directive
Action tags-
They are used for performing for action during the request processing phase of the JSP life cycle.
1. include Action tag
2. Include action tag with parameters
3. forward action tag
4. useBean, setProperty, and getProperty action tags
JSP's Implicit Object -
These Implicit objects are created by the JSP container while translating the JSP page to servlet. These objects are present inside service methods so that we can directly use them without a declaration.
1. out implicit object
2. request implicit object
3. response implicit object
4. session implicit object
5. application implicit object
6. exception implicit object
7. pageContext implicit object
8. page implicit object
9. config implicit object
Expression Language (EL) in JSP
By using Expression language we can easily access the data variables, bean components, and expression using Expression language. Recommended for JSP beginner to read this topic in detail.
Exception Handling-
We have explained the exception handling method used in JSP. Do check out this topic for a detail explanation.
JSP API Interface and Classes
All the core JSP interfaces and classes are defined in javax.servlet.jsp package. Expression
Language API interfaces are classes and are part of javax.servlet.jsp.el package. JSP Tag Libraries
interfaces and classes are defined in javax.servlet.jsp.tagext package.
1. JspPage Interface-
JspPage interface extends Servlet interface and declares jspInit() and jspDestroy() life cycle
methods of the JSP pages.
2. HttpJspPage Interface:
HttpJspPage interface describes the interaction that a JSP Page Implementation Class must satisfy
when using the HTTP protocol. This interface declares the service method of JSP page for HTTP
protocol as public void_jspService(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException.
3. JspWriter abstract Class:
Similar to PrintWriter in servlets with the additional facility of buffering support. This is one of the
implicit variables in a JSP page with the name “out”. This class extends java.io.Writer and container
provide their own implementation for this abstract class and use it while translating the JSP page to
Servlet. We can get its object using PageContext.getOut() method.
Apache Tomacat concrete class for JspWriter is org.apche.jasper.runtime.JspWriterImpl.
4. JspContext abstract Class:
JspContext serves as the base class for the PageContext class and abstracts all information that is
not specific to servlets. The JspContext provides a mechanism to obtain the JspWriter for output, a mechanism to work with attributes, and API to manage the various scoped namespaces.
4. JspContext abstract Class:
JspContext serves as the base class for the PageContext class and abstracts all information that is
not specific to servlets. The JspContext provides a mechanism to obtain the JspWriter for output, a mechanism to work with attributes and API to manage the various scoped namespaces.
JSP
5. PageContext abstract Class:
PageContext extends JspContext to provide useful context information when JSP is used for web
applications. A PageContext instance provides access to all the namespaces associated with a JSP
page, provides access to several page attributes, as well as a layer above the implementation details.
Implicit objects are added to the pageContext automatically.
6. JspFactory abstract Class:
The JspFactory is an abstract class that defines a number of factory methods available to a JSP page
at runtime for the purposes of creating instances of various interfaces and classes used to support
the JSP implementation.
7. JspEngineInfo abstract Class:
The JspEngineInfo is an abstract class that provides information on the current JSP engine.
8. ErrorData final Class:
Contains information about an error, for error pages.
9. JspException Class:
A generic exception is known to the JSP container, similar to ServletException.If JSP pages throw
JspException then errorpage mechanism is used to present error information to the user.
10. JspTagException Class:
The exception to be used by a Tag Handler to indicate some unrecoverable error.
11. SkipPageException Class:
The exception to indicate the calling page must cease evaluation. Thrown by a simple tag handler to
indicate that the remainder of the page must not be evaluated. This exception should not be thrown
manually in a JSP page
Recommended Topics:
ConversionConversion EmoticonEmoticon