001    /*
002    * Copyright 2004 The Apache Software Foundation
003    *
004    * Licensed under the Apache License, Version 2.0 (the "License");
005    * you may not use this file except in compliance with the License.
006    * You may obtain a copy of the License at
007    *
008    *     http://www.apache.org/licenses/LICENSE-2.0
009    *
010    * Unless required by applicable law or agreed to in writing, software
011    * distributed under the License is distributed on an "AS IS" BASIS,
012    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013    * See the License for the specific language governing permissions and
014    * limitations under the License.
015    */
016    package examples;
017    
018    import javax.servlet.jsp.*;
019    import javax.servlet.jsp.tagext.*;
020    
021    public abstract class ExampleTagBase extends BodyTagSupport {
022    
023        public void setParent(Tag parent) {
024            this.parent = parent;
025        }
026    
027        public void setBodyContent(BodyContent bodyOut) {
028            this.bodyOut = bodyOut;
029        }
030    
031        public void setPageContext(PageContext pageContext) {
032            this.pageContext = pageContext;
033        }
034    
035        public Tag getParent() {
036            return this.parent;
037        }
038        
039        public int doStartTag() throws JspException {
040            return SKIP_BODY;
041        }
042    
043        public int doEndTag() throws JspException {
044            return EVAL_PAGE;
045        }
046        
047    
048        // Default implementations for BodyTag methods as well
049        // just in case a tag decides to implement BodyTag.
050        public void doInitBody() throws JspException {
051        }
052    
053        public int doAfterBody() throws JspException {
054            return SKIP_BODY;
055        }
056    
057        public void release() {
058            bodyOut = null;
059            pageContext = null;
060            parent = null;
061        }
062        
063        protected BodyContent bodyOut;
064        protected PageContext pageContext;
065        protected Tag parent;
066    }