JSP API : JSP Application Programming Interface
Java Server Pages API contains four Packages
- javax.el : Provides the API for the Unified Expression Language shared by the JSP 2.1 and JSF 1.2 technologies.
- javax.servlet.jsp : Classes and interfaces for the Core JSP 2.0 API.
- javax.servlet.jsp.el : Provides the ELResolver classes that define the object resolution rules that must be supported by a JSP container with the new unified Expression Language.
- javax.servlet.jsp.tagext : Classes and interfaces for the definition of JavaServer Pages Tag Libraries.
Classes of JSP API available in javax.servlet.jsp
The ErrorData Class
public final class ErrorData extends java.lang.Object : Contains information about an error, for error pages. The information contained in this instance is meaningless if not used in the context of an error page. To indicate a JSP is an error page, the page author must set the isErrorPage attribute of the page directive to “true”.
The JSPWriter Class
public abstract class JspWriter extends java.io.Writer : The actions and template data in a JSP page is written using the JspWriter object that is referenced by the implicit variable out which is initialized automatically using methods in the PageContext object. This abstract class emulates some of the functionality found in the java.io.BufferedWriter and java.io.PrintWriter classes, however it differs in that it throws java.io.IOException from the print methods while PrintWriter does not.
The PageContext Class
public abstract class PageContext extends JspContext : PageContext extends JspContext to provide useful context information for when JSP technology is used in a Servlet environment.
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.
The PageContext class is an abstract class, designed to be extended to provide implementation dependent implementations thereof, by conformant JSP engine runtime environments. A PageContext instance is obtained by a JSP implementation class by calling the JspFactory.getPageContext() method, and is released by calling JspFactory.releasePageContext().
The PageContext provides a number of facilities to the page/component author and page implementor, including:
- a single API to manage the various scoped namespaces
- a number of convenience API’s to access various public objects
- a mechanism to obtain the JspWriter for output
- a mechanism to manage session usage by the page
- a mechanism to expose page directive attributes to the scripting environment
- mechanisms to forward or include the current request to other active components in the application
- a mechanism to handle errorpage exception processing
Classes of JSP API available in javax.servlet.jsp.tagext
public interface Tag extends JspTag
- The interface of a classic tag handler that does not want to manipulate its body.
- The Tag interface defines the basic protocol between a Tag handler and JSP page implementation class.
- It defines the life cycle and the methods to be invoked at start and end tag.
public class TagSupport extends java.lang.Object implements IterationTag, java.io.Serializable
- A base class for defining new tag handlers implementing Tag.
- The TagSupport class is a utility class intended to be used as the base class for new tag handlers.
- The TagSupport class implements the Tag and IterationTag interfaces and adds additional convenience methods including getter methods for the properties in Tag.
- TagSupport has one static method that is included to facilitate coordination among cooperating tags.
- Many tag handlers will extend TagSupport and only redefine a few methods.
public class BodyTagSupport extends TagSupport implements BodyTag
- A base class for defining tag handlers implementing BodyTag.
- The BodyTagSupport class implements the BodyTag interface and adds additional convenience methods including getter methods for the bodyContent property and methods to get at the previous out JspWriter.
- Many tag handlers will extend BodyTagSupport and only redefine a few methods.
public class SimpleTagSupport extends java.lang.Object implements SimpleTag
- A base class for defining tag handlers implementing SimpleTag.
- The SimpleTagSupport class is a utility class intended to be used as the base class for new simple tag handlers.
- The SimpleTagSupport class implements the SimpleTag interface and adds additional convenience methods including getter methods for the properties in SimpleTag.
- SimpleTag extends JspTag and it is from JSP 2.0