1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package javax.servlet.jsp; 18 19 import javax.servlet; 20 21 /** 22 * The JspPage interface describes the generic interaction that a JSP Page 23 * Implementation class must satisfy; pages that use the HTTP protocol 24 * are described by the HttpJspPage interface. 25 * 26 * <p><B>Two plus One Methods</B> 27 * <p> 28 * The interface defines a protocol with 3 methods; only two of 29 * them: jspInit() and jspDestroy() are part of this interface as 30 * the signature of the third method: _jspService() depends on 31 * the specific protocol used and cannot be expressed in a generic 32 * way in Java. 33 * <p> 34 * A class implementing this interface is responsible for invoking 35 * the above methods at the appropriate time based on the 36 * corresponding Servlet-based method invocations. 37 * <p> 38 * The jspInit() and jspDestroy() methods can be defined by a JSP 39 * author, but the _jspService() method is defined automatically 40 * by the JSP processor based on the contents of the JSP page. 41 * 42 * <p><B>_jspService()</B> 43 * <p> 44 * The _jspService()method corresponds to the body of the JSP page. This 45 * method is defined automatically by the JSP container and should never 46 * be defined by the JSP page author. 47 * <p> 48 * If a superclass is specified using the extends attribute, that 49 * superclass may choose to perform some actions in its service() method 50 * before or after calling the _jspService() method. See using the extends 51 * attribute in the JSP_Engine chapter of the JSP specification. 52 * <p> 53 * The specific signature depends on the protocol supported by the JSP page. 54 * 55 * <pre> 56 * public void _jspService(<em>ServletRequestSubtype</em> request, 57 * <em>ServletResponseSubtype</em> response) 58 * throws ServletException, IOException; 59 * </pre> 60 */ 61 62 63 public interface JspPage extends Servlet { 64 65 /** 66 * The jspInit() method is invoked when the JSP page is initialized. It 67 * is the responsibility of the JSP implementation (and of the class 68 * mentioned by the extends attribute, if present) that at this point 69 * invocations to the getServletConfig() method will return the desired 70 * value. 71 * 72 * A JSP page can override this method by including a definition for it 73 * in a declaration element. 74 * 75 * A JSP page should redefine the init() method from Servlet. 76 */ 77 public void jspInit(); 78 79 /** 80 * The jspDestroy() method is invoked when the JSP page is about to be 81 * destroyed. 82 * 83 * A JSP page can override this method by including a definition for it 84 * in a declaration element. 85 * 86 * A JSP page should redefine the destroy() method from Servlet. 87 */ 88 public void jspDestroy(); 89 90 }