KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > examples > ExampleTagBase


1 /*
2 * Copyright 2004 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */

16 package examples;
17
18 import javax.servlet.jsp.*;
19 import javax.servlet.jsp.tagext.*;
20
21 public abstract class ExampleTagBase extends BodyTagSupport {
22
23     public void setParent(Tag parent) {
24         this.parent = parent;
25     }
26
27     public void setBodyContent(BodyContent bodyOut) {
28         this.bodyOut = bodyOut;
29     }
30
31     public void setPageContext(PageContext pageContext) {
32         this.pageContext = pageContext;
33     }
34
35     public Tag getParent() {
36         return this.parent;
37     }
38     
39     public int doStartTag() throws JspException {
40         return SKIP_BODY;
41     }
42
43     public int doEndTag() throws JspException {
44         return EVAL_PAGE;
45     }
46     
47
48     // Default implementations for BodyTag methods as well
49
// just in case a tag decides to implement BodyTag.
50
public void doInitBody() throws JspException {
51     }
52
53     public int doAfterBody() throws JspException {
54         return SKIP_BODY;
55     }
56
57     public void release() {
58         bodyOut = null;
59         pageContext = null;
60         parent = null;
61     }
62     
63     protected BodyContent bodyOut;
64     protected PageContext pageContext;
65     protected Tag parent;
66 }
67
Popular Tags