Name

JspPage

Synopsis

Interface Name:

javax.servlet.jsp.JspPage

Extends:

None

Implemented by:

JSP page implementation classes

Description

The JspPage interface must be implemented by the generated JSP page implementation classes. The interface defines a protocol with three methods; only two of them, jspInit( ) and jspDestroy( ), are part of this interface. The signature of the third method, _jspService( ), depends on the specific protocol used and cannot be expressed in a generic way in Java. See also HttpJspPage.

A class implementing this interface is responsible for invoking these methods at the appropriate time, based on the corresponding servlet-based method invocations.

The jspInit( ) and jspDestroy( ) methods can be defined by a JSP page author, but the _jspService( ) method is defined automatically by the JSP container, based on the contents of the JSP page.

Interface Declarations

public interface JspPage {
  public void jspDestroy( );
  public void jspInit( );
}

Methods

public void jspDestroy( )

This method is invoked when the JSP page implementation instance is about to be destroyed. It can be used to perform cleanup, such as saving the state kept in instance variables to permanent storage.

public void jspInit( )

This method is invoked when the JSP page implementation instance is initialized. It can be used to perform tasks such as restoring the state kept in instance variables from permanent storage.

Get Java Server Pages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.