KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > strutsel > taglib > logic > ELRedirectTag


1 /*
2  * $Id: ELRedirectTag.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.logic;
20
21 import org.apache.struts.taglib.logic.RedirectTag;
22 import javax.servlet.jsp.JspException JavaDoc;
23 import org.apache.strutsel.taglib.utils.EvalHelper;
24
25 /**
26  * Generate a URL-encoded redirect to the specified URI.
27  *<p>
28  * This class is a subclass of the class
29  * <code>org.apache.struts.taglib.logic.RedirectTag</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 ELRedirectTag extends RedirectTag {
37
38     /**
39      * Instance variable mapped to "action" tag attribute.
40      * (Mapping set in associated BeanInfo class.)
41      */

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

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

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

57     private String JavaDoc hrefExpr;
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 "paramId" tag attribute.
70      * (Mapping set in associated BeanInfo class.)
71      */

72     private String JavaDoc paramIdExpr;
73     /**
74      * Instance variable mapped to "paramName" tag attribute.
75      * (Mapping set in associated BeanInfo class.)
76      */

77     private String JavaDoc paramNameExpr;
78     /**
79      * Instance variable mapped to "paramProperty" tag attribute.
80      * (Mapping set in associated BeanInfo class.)
81      */

82     private String JavaDoc paramPropertyExpr;
83     /**
84      * Instance variable mapped to "paramScope" tag attribute.
85      * (Mapping set in associated BeanInfo class.)
86      */

87     private String JavaDoc paramScopeExpr;
88     /**
89      * Instance variable mapped to "property" tag attribute.
90      * (Mapping set in associated BeanInfo class.)
91      */

92     private String JavaDoc propertyExpr;
93     /**
94      * Instance variable mapped to "scope" tag attribute.
95      * (Mapping set in associated BeanInfo class.)
96      */

97     private String JavaDoc scopeExpr;
98     /**
99      * Instance variable mapped to "transaction" tag attribute.
100      * (Mapping set in associated BeanInfo class.)
101      */

102     private String JavaDoc transactionExpr;
103     /**
104      * Instance variable mapped to "useLocalEncoding" tag attribute.
105      * (Mapping set in associated BeanInfo class.)
106      */

107     private String JavaDoc useLocalEncodingExpr;
108
109     /**
110      * Getter method for "action" tag attribute.
111      * (Mapping set in associated BeanInfo class.)
112      */

113     public String JavaDoc getActionExpr() { return (actionExpr); }
114     /**
115      * Getter method for "anchor" tag attribute.
116      * (Mapping set in associated BeanInfo class.)
117      */

118     public String JavaDoc getAnchorExpr() { return (anchorExpr); }
119     /**
120      * Getter method for "forward" tag attribute.
121      * (Mapping set in associated BeanInfo class.)
122      */

123     public String JavaDoc getForwardExpr() { return (forwardExpr); }
124     /**
125      * Getter method for "href" tag attribute.
126      * (Mapping set in associated BeanInfo class.)
127      */

128     public String JavaDoc getHrefExpr() { return (hrefExpr); }
129     /**
130      * Getter method for "name" tag attribute.
131      * (Mapping set in associated BeanInfo class.)
132      */

133     public String JavaDoc getNameExpr() { return (nameExpr); }
134     /**
135      * Getter method for "page" tag attribute.
136      * (Mapping set in associated BeanInfo class.)
137      */

138     public String JavaDoc getPageExpr() { return (pageExpr); }
139     /**
140      * Getter method for "paramId" tag attribute.
141      * (Mapping set in associated BeanInfo class.)
142      */

143     public String JavaDoc getParamIdExpr() { return (paramIdExpr); }
144     /**
145      * Getter method for "paramName" tag attribute.
146      * (Mapping set in associated BeanInfo class.)
147      */

148     public String JavaDoc getParamNameExpr() { return (paramNameExpr); }
149     /**
150      * Getter method for "paramProperty" tag attribute.
151      * (Mapping set in associated BeanInfo class.)
152      */

153     public String JavaDoc getParamPropertyExpr() { return (paramPropertyExpr); }
154     /**
155      * Getter method for "paramScope" tag attribute.
156      * (Mapping set in associated BeanInfo class.)
157      */

158     public String JavaDoc getParamScopeExpr() { return (paramScopeExpr); }
159     /**
160      * Getter method for "property" tag attribute.
161      * (Mapping set in associated BeanInfo class.)
162      */

163     public String JavaDoc getPropertyExpr() { return (propertyExpr); }
164     /**
165      * Getter method for "scope" tag attribute.
166      * (Mapping set in associated BeanInfo class.)
167      */

168     public String JavaDoc getScopeExpr() { return (scopeExpr); }
169     /**
170      * Getter method for "transaction" tag attribute.
171      * (Mapping set in associated BeanInfo class.)
172      */

173     public String JavaDoc getTransactionExpr() { return (transactionExpr); }
174     /**
175      * Getter method for "useLocalEncoding" tag attribute.
176      * (Mapping set in associated BeanInfo class.)
177      */

178     public String JavaDoc getUseLocalEncodingExpr() { return (useLocalEncodingExpr); }
179
180     /**
181      * Setter method for "action" tag attribute.
182      * (Mapping set in associated BeanInfo class.)
183      */

184     public void setActionExpr(String JavaDoc actionExpr) { this.actionExpr = actionExpr; }
185     /**
186      * Setter method for "anchor" tag attribute.
187      * (Mapping set in associated BeanInfo class.)
188      */

189     public void setAnchorExpr(String JavaDoc anchorExpr) { this.anchorExpr = anchorExpr; }
190     /**
191      * Setter method for "forward" tag attribute.
192      * (Mapping set in associated BeanInfo class.)
193      */

194     public void setForwardExpr(String JavaDoc forwardExpr) { this.forwardExpr = forwardExpr; }
195     /**
196      * Setter method for "href" tag attribute.
197      * (Mapping set in associated BeanInfo class.)
198      */

199     public void setHrefExpr(String JavaDoc hrefExpr) { this.hrefExpr = hrefExpr; }
200     /**
201      * Setter method for "name" tag attribute.
202      * (Mapping set in associated BeanInfo class.)
203      */

204     public void setNameExpr(String JavaDoc nameExpr) { this.nameExpr = nameExpr; }
205     /**
206      * Setter method for "page" tag attribute.
207      * (Mapping set in associated BeanInfo class.)
208      */

209     public void setPageExpr(String JavaDoc pageExpr) { this.pageExpr = pageExpr; }
210     /**
211      * Setter method for "paramId" tag attribute.
212      * (Mapping set in associated BeanInfo class.)
213      */

214     public void setParamIdExpr(String JavaDoc paramIdExpr) { this.paramIdExpr = paramIdExpr; }
215     /**
216      * Setter method for "paramName" tag attribute.
217      * (Mapping set in associated BeanInfo class.)
218      */

219     public void setParamNameExpr(String JavaDoc paramNameExpr) { this.paramNameExpr = paramNameExpr; }
220     /**
221      * Setter method for "paramProperty" tag attribute.
222      * (Mapping set in associated BeanInfo class.)
223      */

224     public void setParamPropertyExpr(String JavaDoc paramPropertyExpr) { this.paramPropertyExpr = paramPropertyExpr; }
225     /**
226      * Setter method for "paramScope" tag attribute.
227      * (Mapping set in associated BeanInfo class.)
228      */

229     public void setParamScopeExpr(String JavaDoc paramScopeExpr) { this.paramScopeExpr = paramScopeExpr; }
230     /**
231      * Setter method for "property" tag attribute.
232      * (Mapping set in associated BeanInfo class.)
233      */

234     public void setPropertyExpr(String JavaDoc propertyExpr) { this.propertyExpr = propertyExpr; }
235     /**
236      * Setter method for "scope" tag attribute.
237      * (Mapping set in associated BeanInfo class.)
238      */

239     public void setScopeExpr(String JavaDoc scopeExpr) { this.scopeExpr = scopeExpr; }
240     /**
241      * Setter method for "transaction" tag attribute.
242      * (Mapping set in associated BeanInfo class.)
243      */

244     public void setTransactionExpr(String JavaDoc transactionExpr) { this.transactionExpr = transactionExpr; }
245     /**
246      * Setter method for "useLocalEncoding" tag attribute.
247      * (Mapping set in associated BeanInfo class.)
248      */

249     public void setUseLocalEncodingExpr(String JavaDoc useLocalEncodingExpr) { this.useLocalEncodingExpr = useLocalEncodingExpr; }
250
251     /**
252      * Resets attribute values for tag reuse.
253      */

254     public void release()
255     {
256         super.release();
257         setActionExpr(null);
258         setAnchorExpr(null);
259         setForwardExpr(null);
260         setHrefExpr(null);
261         setNameExpr(null);
262         setPageExpr(null);
263         setParamIdExpr(null);
264         setParamNameExpr(null);
265         setParamPropertyExpr(null);
266         setParamScopeExpr(null);
267         setPropertyExpr(null);
268         setScopeExpr(null);
269         setTransactionExpr(null);
270         setUseLocalEncodingExpr(null);
271     }
272
273     /**
274      * Process the start tag.
275      *
276      * @exception JspException if a JSP exception has occurred
277      */

278     public int doStartTag() throws JspException JavaDoc {
279         evaluateExpressions();
280         return (super.doStartTag());
281     }
282
283     /**
284      * Processes all attribute values which use the JSTL expression evaluation
285      * engine to determine their values.
286      *
287      * @exception JspException if a JSP exception has occurred
288      */

289     private void evaluateExpressions() throws JspException JavaDoc {
290         String JavaDoc string = null;
291         Boolean JavaDoc bool = null;
292
293         if ((string = EvalHelper.evalString("action", getActionExpr(),
294                                             this, pageContext)) != null)
295             setAction(string);
296
297         if ((string = EvalHelper.evalString("anchor", getAnchorExpr(),
298                                             this, pageContext)) != null)
299             setAnchor(string);
300
301         if ((string = EvalHelper.evalString("forward", getForwardExpr(),
302                                             this, pageContext)) != null)
303             setForward(string);
304
305         if ((string = EvalHelper.evalString("href", getHrefExpr(),
306                                             this, pageContext)) != null)
307             setHref(string);
308
309         if ((string = EvalHelper.evalString("name", getNameExpr(),
310                                             this, pageContext)) != null)
311             setName(string);
312
313         if ((string = EvalHelper.evalString("page", getPageExpr(),
314                                             this, pageContext)) != null)
315             setPage(string);
316
317         if ((string = EvalHelper.evalString("paramId", getParamIdExpr(),
318                                             this, pageContext)) != null)
319             setParamId(string);
320
321         if ((string = EvalHelper.evalString("paramName", getParamNameExpr(),
322                                             this, pageContext)) != null)
323             setParamName(string);
324
325         if ((string = EvalHelper.evalString("paramProperty", getParamPropertyExpr(),
326                                             this, pageContext)) != null)
327             setParamProperty(string);
328
329         if ((string = EvalHelper.evalString("paramScope", getParamScopeExpr(),
330                                             this, pageContext)) != null)
331             setParamScope(string);
332
333         if ((string = EvalHelper.evalString("property", getPropertyExpr(),
334                                             this, pageContext)) != null)
335             setProperty(string);
336
337         if ((string = EvalHelper.evalString("scope", getScopeExpr(),
338                                             this, pageContext)) != null)
339             setScope(string);
340
341         if ((bool = EvalHelper.evalBoolean("transaction", getTransactionExpr(),
342                                            this, pageContext)) != null)
343             setTransaction(bool.booleanValue());
344
345         if ((bool = EvalHelper.evalBoolean("useLocalEncoding", getUseLocalEncodingExpr(),
346                                            this, pageContext)) != null)
347             setUseLocalEncoding(bool.booleanValue());
348     }
349 }
350
Popular Tags