001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package javax.servlet.jsp; 018 019 import javax.servlet.*; 020 021 /** 022 * The JspPage interface describes the generic interaction that a JSP Page 023 * Implementation class must satisfy; pages that use the HTTP protocol 024 * are described by the HttpJspPage interface. 025 * 026 * <p><B>Two plus One Methods</B> 027 * <p> 028 * The interface defines a protocol with 3 methods; only two of 029 * them: jspInit() and jspDestroy() are part of this interface as 030 * the signature of the third method: _jspService() depends on 031 * the specific protocol used and cannot be expressed in a generic 032 * way in Java. 033 * <p> 034 * A class implementing this interface is responsible for invoking 035 * the above methods at the appropriate time based on the 036 * corresponding Servlet-based method invocations. 037 * <p> 038 * The jspInit() and jspDestroy() methods can be defined by a JSP 039 * author, but the _jspService() method is defined automatically 040 * by the JSP processor based on the contents of the JSP page. 041 * 042 * <p><B>_jspService()</B> 043 * <p> 044 * The _jspService()method corresponds to the body of the JSP page. This 045 * method is defined automatically by the JSP container and should never 046 * be defined by the JSP page author. 047 * <p> 048 * If a superclass is specified using the extends attribute, that 049 * superclass may choose to perform some actions in its service() method 050 * before or after calling the _jspService() method. See using the extends 051 * attribute in the JSP_Engine chapter of the JSP specification. 052 * <p> 053 * The specific signature depends on the protocol supported by the JSP page. 054 * 055 * <pre> 056 * public void _jspService(<em>ServletRequestSubtype</em> request, 057 * <em>ServletResponseSubtype</em> response) 058 * throws ServletException, IOException; 059 * </pre> 060 */ 061 062 063 public interface JspPage extends Servlet { 064 065 /** 066 * The jspInit() method is invoked when the JSP page is initialized. It 067 * is the responsibility of the JSP implementation (and of the class 068 * mentioned by the extends attribute, if present) that at this point 069 * invocations to the getServletConfig() method will return the desired 070 * value. 071 * 072 * A JSP page can override this method by including a definition for it 073 * in a declaration element. 074 * 075 * A JSP page should redefine the init() method from Servlet. 076 */ 077 public void jspInit(); 078 079 /** 080 * The jspDestroy() method is invoked when the JSP page is about to be 081 * destroyed. 082 * 083 * A JSP page can override this method by including a definition for it 084 * in a declaration element. 085 * 086 * A JSP page should redefine the destroy() method from Servlet. 087 */ 088 public void jspDestroy(); 089 090 }