KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > taglibs > standard > tag > rt > core > IfTag


1 /*
2  * Copyright 1999-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
17 package org.apache.taglibs.standard.tag.rt.core;
18
19 import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
20
21 /**
22  * <p>Tag handler for &lt;if&gt; in JSTL's rtexprvalue library. Because
23  * of the support provided by the ConditionalTagSupport class, this
24  * tag is trivial enough not to require a separate base supporting class
25  * common to both libraries.</p>
26  *
27  * @author Shawn Bayern
28  */

29
30 public class IfTag extends ConditionalTagSupport {
31
32     //*********************************************************************
33
// Constructor and lifecycle management
34

35     // initialize inherited and local state
36
public IfTag() {
37         super();
38         init();
39     }
40
41     // Releases any resources we may have (or inherit)
42
public void release() {
43         super.release();
44         init();
45     }
46
47
48     //*********************************************************************
49
// Supplied conditional logic
50

51     protected boolean condition() {
52         return test;
53     }
54
55
56     //*********************************************************************
57
// Private state
58

59     private boolean test; // the value of the 'test' attribute
60

61
62     //*********************************************************************
63
// Accessors
64

65     // receives the tag's 'test' attribute
66
public void setTest(boolean test) {
67         this.test = test;
68     }
69
70
71     //*********************************************************************
72
// Private utility methods
73

74     // resets internal state
75
private void init() {
76         test = false;
77     }
78 }
79
Popular Tags