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 examples;
018    
019    import javax.servlet.jsp.JspException;
020    import javax.servlet.jsp.PageContext;
021    import javax.servlet.jsp.tagext.BodyContent;
022    import javax.servlet.jsp.tagext.BodyTagSupport;
023    import javax.servlet.jsp.tagext.Tag;
024    
025    public abstract class ExampleTagBase extends BodyTagSupport {
026    
027        public void setParent(Tag parent) {
028            this.parent = parent;
029        }
030    
031        public void setBodyContent(BodyContent bodyOut) {
032            this.bodyOut = bodyOut;
033        }
034    
035        public void setPageContext(PageContext pageContext) {
036            this.pageContext = pageContext;
037        }
038    
039        public Tag getParent() {
040            return this.parent;
041        }
042    
043        public int doStartTag() throws JspException {
044            return SKIP_BODY;
045        }
046    
047        public int doEndTag() throws JspException {
048            return EVAL_PAGE;
049        }
050    
051    
052        // Default implementations for BodyTag methods as well
053        // just in case a tag decides to implement BodyTag.
054        public void doInitBody() throws JspException {
055        }
056    
057        public int doAfterBody() throws JspException {
058            return SKIP_BODY;
059        }
060    
061        public void release() {
062            bodyOut = null;
063            pageContext = null;
064            parent = null;
065        }
066    
067        protected BodyContent bodyOut;
068        protected PageContext pageContext;
069        protected Tag parent;
070    }