KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > strutsel > taglib > bean > ELIncludeTag


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

18
19 package org.apache.strutsel.taglib.bean;
20
21 import org.apache.struts.taglib.bean.IncludeTag;
22 import javax.servlet.jsp.JspException JavaDoc;
23 import org.apache.strutsel.taglib.utils.EvalHelper;
24
25 /**
26  * Generate a URL-encoded include to the specified URI.
27  *<p>
28  * This class is a subclass of the class
29  * <code>org.apache.struts.taglib.bean.IncludeTag</code> which
30  * provides most of the described functionality. This subclass allows all
31  * attribute values to be specified as expressions utilizing the JavaServer
32  * Pages Standard Library expression language.
33  *
34  * @version $Rev: 54933 $
35  */

36 public class ELIncludeTag extends IncludeTag {
37
38     /**
39      * Instance variable mapped to "anchor" tag attribute.
40      * (Mapping set in associated BeanInfo class.)
41      */

42     private String JavaDoc anchorExpr;
43     /**
44      * Instance variable mapped to "forward" tag attribute.
45      * (Mapping set in associated BeanInfo class.)
46      */

47     private String JavaDoc forwardExpr;
48     /**
49      * Instance variable mapped to "href" tag attribute.
50      * (Mapping set in associated BeanInfo class.)
51      */

52     private String JavaDoc hrefExpr;
53     /**
54      * Instance variable mapped to "id" tag attribute.
55      * (Mapping set in associated BeanInfo class.)
56      */

57     private String JavaDoc idExpr;
58     /**
59      * Instance variable mapped to "name" tag attribute.
60      * (Mapping set in associated BeanInfo class.)
61      */

62     private String JavaDoc nameExpr;
63     /**
64      * Instance variable mapped to "page" tag attribute.
65      * (Mapping set in associated BeanInfo class.)
66      */

67     private String JavaDoc pageExpr;
68     /**
69      * Instance variable mapped to "transaction" tag attribute.
70      * (Mapping set in associated BeanInfo class.)
71      */

72     private String JavaDoc transactionExpr;
73
74     /**
75      * Getter method for "anchor" tag attribute.
76      * (Mapping set in associated BeanInfo class.)
77      */

78     public String JavaDoc getAnchorExpr() { return (anchorExpr); }
79     /**
80      * Getter method for "forward" tag attribute.
81      * (Mapping set in associated BeanInfo class.)
82      */

83     public String JavaDoc getForwardExpr() { return (forwardExpr); }
84     /**
85      * Getter method for "href" tag attribute.
86      * (Mapping set in associated BeanInfo class.)
87      */

88     public String JavaDoc getHrefExpr() { return (hrefExpr); }
89     /**
90      * Getter method for "id" tag attribute.
91      * (Mapping set in associated BeanInfo class.)
92      */

93     public String JavaDoc getIdExpr() { return (idExpr); }
94     /**
95      * Getter method for "name" tag attribute.
96      * (Mapping set in associated BeanInfo class.)
97      */

98     public String JavaDoc getNameExpr() { return (nameExpr); }
99     /**
100      * Getter method for "page" tag attribute.
101      * (Mapping set in associated BeanInfo class.)
102      */

103     public String JavaDoc getPageExpr() { return (pageExpr); }
104     /**
105      * Getter method for "transaction" tag attribute.
106      * (Mapping set in associated BeanInfo class.)
107      */

108     public String JavaDoc getTransactionExpr() { return (transactionExpr); }
109
110     /**
111      * Setter method for "anchor" tag attribute.
112      * (Mapping set in associated BeanInfo class.)
113      */

114     public void setAnchorExpr(String JavaDoc anchorExpr) { this.anchorExpr = anchorExpr; }
115     /**
116      * Setter method for "forward" tag attribute.
117      * (Mapping set in associated BeanInfo class.)
118      */

119     public void setForwardExpr(String JavaDoc forwardExpr) { this.forwardExpr = forwardExpr; }
120     /**
121      * Setter method for "href" tag attribute.
122      * (Mapping set in associated BeanInfo class.)
123      */

124     public void setHrefExpr(String JavaDoc hrefExpr) { this.hrefExpr = hrefExpr; }
125     /**
126      * Setter method for "id" tag attribute.
127      * (Mapping set in associated BeanInfo class.)
128      */

129     public void setIdExpr(String JavaDoc idExpr) { this.idExpr = idExpr; }
130     /**
131      * Setter method for "name" tag attribute.
132      * (Mapping set in associated BeanInfo class.)
133      */

134     public void setNameExpr(String JavaDoc nameExpr) { this.nameExpr = nameExpr; }
135     /**
136      * Setter method for "page" tag attribute.
137      * (Mapping set in associated BeanInfo class.)
138      */

139     public void setPageExpr(String JavaDoc pageExpr) { this.pageExpr = pageExpr; }
140     /**
141      * Setter method for "transaction" tag attribute.
142      * (Mapping set in associated BeanInfo class.)
143      */

144     public void setTransactionExpr(String JavaDoc transactionExpr) { this.transactionExpr = transactionExpr; }
145
146     /**
147      * Resets attribute values for tag reuse.
148      */

149     public void release()
150     {
151         super.release();
152         setAnchorExpr(null);
153         setForwardExpr(null);
154         setHrefExpr(null);
155         setIdExpr(null);
156         setNameExpr(null);
157         setPageExpr(null);
158         setTransactionExpr(null);
159     }
160
161     /**
162      * Process the start tag.
163      *
164      * @exception JspException if a JSP exception has occurred
165      */

166     public int doStartTag() throws JspException JavaDoc {
167         evaluateExpressions();
168         return (super.doStartTag());
169     }
170
171     /**
172      * Processes all attribute values which use the JSTL expression evaluation
173      * engine to determine their values.
174      *
175      * @exception JspException if a JSP exception has occurred
176      */

177     private void evaluateExpressions() throws JspException JavaDoc {
178         String JavaDoc string = null;
179         Boolean JavaDoc bool = null;
180
181         if ((string = EvalHelper.evalString("anchor", getAnchorExpr(),
182                                             this, pageContext)) != null)
183             setAnchor(string);
184
185         if ((string = EvalHelper.evalString("forward", getForwardExpr(),
186                                             this, pageContext)) != null)
187             setForward(string);
188
189         if ((string = EvalHelper.evalString("href", getHrefExpr(),
190                                             this, pageContext)) != null)
191             setHref(string);
192
193         if ((string = EvalHelper.evalString("id", getIdExpr(),
194                                             this, pageContext)) != null)
195             setId(string);
196
197         if ((string = EvalHelper.evalString("name", getNameExpr(),
198                                             this, pageContext)) != null)
199             setName(string);
200
201         if ((string = EvalHelper.evalString("page", getPageExpr(),
202                                             this, pageContext)) != null)
203             setPage(string);
204
205         if ((bool = EvalHelper.evalBoolean("transaction", getTransactionExpr(),
206                                            this, pageContext)) != null)
207             setTransaction(bool.booleanValue());
208     }
209 }
210
Popular Tags